Przeglądaj źródła

ddded button to remove external elements (fix #506)

Gildas 5 lat temu
rodzic
commit
765410a2e0

+ 15 - 11
_locales/de/messages.json

@@ -3,14 +3,14 @@
 		"message": "Speichern einer kompletten Webseite in eine einzige HTML-Datei",
 		"description": "Description of the extension."
 	},
-    "commandSaveTab": {
-        "message": "Speichern der aktuellen Tab oder des ausgewählten Inhalts",
-        "description": "Command (Ctrl+Shift+Y): 'Save the current tab or the selected content'"
-    },
-    "commandSaveAllTabs": {
-        "message": "Speichern aller Tabs",
-        "description": "Command (Ctrl+Shift+U): 'Save all tabs'"
-    },
+	"commandSaveTab": {
+		"message": "Speichern der aktuellen Tab oder des ausgewählten Inhalts",
+		"description": "Command (Ctrl+Shift+Y): 'Save the current tab or the selected content'"
+	},
+	"commandSaveAllTabs": {
+		"message": "Speichern aller Tabs",
+		"description": "Command (Ctrl+Shift+U): 'Save all tabs'"
+	},
 	"menuSavePage": {
 		"message": "Speichern der Webseite mit SingleFile",
 		"description": "Menu entry: 'Save page with SingleFile'"
@@ -615,9 +615,13 @@
 		"message": "Die Seite zur besseren Lesbarkeit formatieren",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Aktivieren/Deaktivieren des Entfernens des Dokument-Elements auf Klick",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Aktivieren/Deaktivieren der Entfernung interner Elemente",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Aktivieren/Deaktivieren der Entfernung externer Elemente",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Wiederherstellen des zuletzt entfernten Elements",

+ 7 - 3
_locales/en/messages.json

@@ -615,9 +615,13 @@
 		"message": "Format the page for better readability",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Enable/disable removing document's element on click",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Restore last removed element",

+ 7 - 3
_locales/es/messages.json

@@ -615,9 +615,13 @@
 		"message": "Format the page for better readability",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Enable/disable removing document's element on click",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Restore last removed element",

+ 7 - 3
_locales/fr/messages.json

@@ -615,9 +615,13 @@
 		"message": "Formater la  page pour une meilleure lisibilité",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Activer/désactiver la supression des éléments du document au click",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Activer/désactiver la supression des éléments internes",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Activer/désactiver la supression des éléments externes",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Restaurer le dernier élement supprimé",

+ 7 - 3
_locales/ja/messages.json

@@ -615,9 +615,13 @@
 		"message": "Format the page for better readability",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "クリック時にドキュメントの要素を削除することを有効/無効にする",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "最後に削除された要素を復元する",

+ 7 - 3
_locales/pl/messages.json

@@ -615,9 +615,13 @@
 		"message": "Sformatuj stronę dla lepszej czytelności",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Włącz/wyłącz usuwanie elementu dokumentu po kliknięciu",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Przywróć ostatni usunięty element",

+ 7 - 3
_locales/ru/messages.json

@@ -615,9 +615,13 @@
 		"message": "Форматировать страницу для лучшей читаемости",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Включить/отключить удаление элемента документа щелчком мыши",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Восстановить последний удалённый элемент",

+ 7 - 3
_locales/uk/messages.json

@@ -615,9 +615,13 @@
 		"message": "Format the page for better readability",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "Enable/disable removing document's element on click",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "Restore last removed element",

+ 7 - 3
_locales/zh_CN/messages.json

@@ -615,9 +615,13 @@
 		"message": "格式化该页面以提升可读性",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "启用/禁用 点击时删除文档元素",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "还原上次被移除的元素",

+ 7 - 3
_locales/zh_TW/messages.json

@@ -615,9 +615,13 @@
 		"message": "格式化該頁面以提升可讀性",
 		"description": "Title of the button 'Format the page for better readability' in the editor"
 	},
-	"editorCutPage": {
-		"message": "啟用/禁用 點擊時刪除文檔元素",
-		"description": "Title of the button 'Enable/disable removing document's element on click' in the editor"
+	"editorCutInnerPage": {
+		"message": "Enable/disable removing of internal elements",
+		"description": "Title of the button 'Enable/disable removing of internal elements' in the editor"
+	},
+	"editorCutOuterPage": {
+		"message": "Enable/disable removing of external elements",
+		"description": "Title of the button 'Enable/disable removing of external elements' in the editor"
 	},
 	"editorUndoCutPage": {
 		"message": "還原上次被移除的元素",

+ 63 - 21
extension/ui/bg/ui-editor.js

@@ -41,7 +41,8 @@ singlefile.extension.ui.bg.editor = (() => {
 	const addGreenNoteButton = document.querySelector(".add-note-green-button");
 	const editPageButton = document.querySelector(".edit-page-button");
 	const formatPageButton = document.querySelector(".format-page-button");
-	const cutPageButton = document.querySelector(".cut-page-button");
+	const cutInnerPageButton = document.querySelector(".cut-inner-page-button");
+	const cutOuterPageButton = document.querySelector(".cut-outer-page-button");
 	const undoCutPageButton = document.querySelector(".undo-cut-page-button");
 	const undoAllCutPageButton = document.querySelector(".undo-all-cut-page-button");
 	const redoCutPageButton = document.querySelector(".redo-cut-page-button");
@@ -62,7 +63,8 @@ singlefile.extension.ui.bg.editor = (() => {
 	removeHighlightButton.title = browser.i18n.getMessage("editorRemoveHighlight");
 	editPageButton.title = browser.i18n.getMessage("editorEditPage");
 	formatPageButton.title = browser.i18n.getMessage("editorFormatPage");
-	cutPageButton.title = browser.i18n.getMessage("editorCutPage");
+	cutInnerPageButton.title = browser.i18n.getMessage("editorCutInnerPage");
+	cutOuterPageButton.title = browser.i18n.getMessage("editorCutOuterPage");
 	undoCutPageButton.title = browser.i18n.getMessage("editorUndoCutPage");
 	undoAllCutPageButton.title = browser.i18n.getMessage("editorUndoAllCutPage");
 	redoCutPageButton.title = browser.i18n.getMessage("editorRedoCutPage");
@@ -74,8 +76,11 @@ singlefile.extension.ui.bg.editor = (() => {
 	addGreenNoteButton.onclick = () => editorElement.contentWindow.postMessage(JSON.stringify({ method: "addNote", color: "note-green" }), "*");
 	highlightButtons.forEach(highlightButton => {
 		highlightButton.onclick = () => {
-			if (toolbarElement.classList.contains("cut-mode")) {
-				disableCutPage();
+			if (toolbarElement.classList.contains("cut-inner-mode")) {
+				disableCutInnerPage();
+			}
+			if (toolbarElement.classList.contains("cut-outer-mode")) {
+				disableCutOuterPage();
 			}
 			if (toolbarElement.classList.contains("remove-highlight-mode")) {
 				disableRemoveHighlights();
@@ -108,8 +113,11 @@ singlefile.extension.ui.bg.editor = (() => {
 		}
 	};
 	removeHighlightButton.onclick = () => {
-		if (toolbarElement.classList.contains("cut-mode")) {
-			disableCutPage();
+		if (toolbarElement.classList.contains("cut-inner-mode")) {
+			disableCutInnerPage();
+		}
+		if (toolbarElement.classList.contains("cut-outer-mode")) {
+			disableCutOuterPage();
 		}
 		if (removeHighlightButton.classList.contains("remove-highlight-disabled")) {
 			removeHighlightButton.classList.remove("remove-highlight-disabled");
@@ -123,8 +131,11 @@ singlefile.extension.ui.bg.editor = (() => {
 		}
 	};
 	editPageButton.onclick = () => {
-		if (toolbarElement.classList.contains("cut-mode")) {
-			disableCutPage();
+		if (toolbarElement.classList.contains("cut-inner-mode")) {
+			disableCutInnerPage();
+		}
+		if (toolbarElement.classList.contains("cut-outer-mode")) {
+			disableCutOuterPage();
 		}
 		if (editPageButton.classList.contains("edit-disabled")) {
 			enableEditPage();
@@ -135,15 +146,32 @@ singlefile.extension.ui.bg.editor = (() => {
 	formatPageButton.onclick = () => {
 		enableFormatPage();
 	};
-	cutPageButton.onclick = () => {
+	cutInnerPageButton.onclick = () => {
+		if (toolbarElement.classList.contains("edit-mode")) {
+			disableEditPage();
+		}
+		if (toolbarElement.classList.contains("cut-outer-mode")) {
+			disableCutOuterPage();
+		}
+		if (cutInnerPageButton.classList.contains("cut-disabled")) {
+			enableCutInnerPage();
+			editorElement.contentWindow.focus();
+		} else {
+			disableCutInnerPage();
+		}
+	};
+	cutOuterPageButton.onclick = () => {
 		if (toolbarElement.classList.contains("edit-mode")) {
 			disableEditPage();
 		}
-		if (cutPageButton.classList.contains("cut-disabled")) {
-			enableCutPage();
+		if (toolbarElement.classList.contains("cut-inner-mode")) {
+			disableCutInnerPage();
+		}
+		if (cutOuterPageButton.classList.contains("cut-disabled")) {
+			enableCutOuterPage();
 			editorElement.contentWindow.focus();
 		} else {
-			disableCutPage();
+			disableCutOuterPage();
 		}
 	};
 	undoCutPageButton.onclick = () => {
@@ -195,7 +223,7 @@ singlefile.extension.ui.bg.editor = (() => {
 			} else if (tabData.options.defaultEditorMode == "format" && !tabData.options.disableFormatPage) {
 				enableFormatPage();
 			} else if (tabData.options.defaultEditorMode == "cut") {
-				enableCutPage();
+				enableCutInnerPage();
 			}
 		}
 	};
@@ -248,10 +276,16 @@ singlefile.extension.ui.bg.editor = (() => {
 		editorElement.contentWindow.postMessage(JSON.stringify({ method: "disableEditPage" }), "*");
 	}
 
-	function disableCutPage() {
-		cutPageButton.classList.add("cut-disabled");
-		toolbarElement.classList.remove("cut-mode");
-		editorElement.contentWindow.postMessage(JSON.stringify({ method: "disableCutPage" }), "*");
+	function disableCutInnerPage() {
+		cutInnerPageButton.classList.add("cut-disabled");
+		toolbarElement.classList.remove("cut-inner-mode");
+		editorElement.contentWindow.postMessage(JSON.stringify({ method: "disableCutInnerPage" }), "*");
+	}
+
+	function disableCutOuterPage() {
+		cutOuterPageButton.classList.add("cut-disabled");
+		toolbarElement.classList.remove("cut-outer-mode");
+		editorElement.contentWindow.postMessage(JSON.stringify({ method: "disableCutOuterPage" }), "*");
 	}
 
 	function resetHighlightButtons() {
@@ -284,12 +318,20 @@ singlefile.extension.ui.bg.editor = (() => {
 		}
 	}
 
-	function enableCutPage() {
-		cutPageButton.classList.remove("cut-disabled");
-		toolbarElement.classList.add("cut-mode");
+	function enableCutInnerPage() {
+		cutInnerPageButton.classList.remove("cut-disabled");
+		toolbarElement.classList.add("cut-inner-mode");
+		resetHighlightButtons();
+		disableRemoveHighlights();
+		editorElement.contentWindow.postMessage(JSON.stringify({ method: "enableCutInnerPage" }), "*");
+	}
+
+	function enableCutOuterPage() {
+		cutOuterPageButton.classList.remove("cut-disabled");
+		toolbarElement.classList.add("cut-outer-mode");
 		resetHighlightButtons();
 		disableRemoveHighlights();
-		editorElement.contentWindow.postMessage(JSON.stringify({ method: "enableCutPage" }), "*");
+		editorElement.contentWindow.postMessage(JSON.stringify({ method: "enableCutOuterPage" }), "*");
 	}
 
 	function savePage() {

+ 53 - 21
extension/ui/content/content-ui-editor-web.js

@@ -46,7 +46,8 @@
 	const REMOVED_CONTENT_CLASS = "single-file-removed";
 	const HIGHLIGHT_HIDDEN_CLASS = "single-file-highlight-hidden";
 	const PAGE_MASK_ACTIVE_CLASS = "page-mask-active";
-	const CUT_HOVER_CLASS = "single-file-hover";
+	const CUT_HOVER_CLASS = "single-file-cut-hover";
+	const CUT_OUTER_HOVER_CLASS = "single-file-cut-outer-hover";
 	const CUT_CONTAINER_HOVER_CLASS = "single-file-container-hover";
 	const NOTE_INITIAL_POSITION_X = 20;
 	const NOTE_INITIAL_POSITION_Y = 20;
@@ -810,7 +811,7 @@ table {
 }`;
 
 	let NOTES_WEB_STYLESHEET, MASK_WEB_STYLESHEET, HIGHLIGHTS_WEB_STYLESHEET;
-	let selectedNote, anchorElement, maskNoteElement, maskPageElement, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, highlightColor, collapseNoteTimeout, cuttingMode, cuttingPath, cuttingPathIndex, cuttingElementContainer;
+	let selectedNote, anchorElement, maskNoteElement, maskPageElement, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, highlightColor, collapseNoteTimeout, cuttingOuterMode, cuttingMode, cuttingPath, cuttingPathIndex, cuttingElementContainer;
 	let removedElements = [], removedElementIndex = 0;
 
 	window.onmessage = async event => {
@@ -862,22 +863,32 @@ table {
 		if (message.method == "disableEditPage") {
 			document.body.contentEditable = false;
 		}
-		if (message.method == "enableCutPage") {
+		if (message.method == "enableCutInnerPage") {
 			cuttingMode = true;
 		}
-		if (message.method == "disableCutPage") {
+		if (message.method == "enableCutOuterPage") {
+			cuttingOuterMode = true;
+		}
+		if (message.method == "disableCutInnerPage") {
 			cuttingMode = false;
 			if (cuttingPath) {
 				unhighlightCutElement();
 				cuttingPath = null;
 			}
 		}
+		if (message.method == "disableCutOuterPage") {
+			cuttingOuterMode = false;
+			if (cuttingPath) {
+				unhighlightCutElement();
+				cuttingPath = null;
+			}
+		}
 		if (message.method == "undoCutPage") {
 			undoCutPage();
 		}
 		if (message.method == "undoAllCutPage") {
 			while (removedElementIndex) {
-				removedElements[removedElementIndex - 1].classList.remove(REMOVED_CONTENT_CLASS);
+				removedElements[removedElementIndex - 1].forEach(element => element.classList.remove(REMOVED_CONTENT_CLASS));
 				removedElementIndex--;
 			}
 		}
@@ -1190,13 +1201,13 @@ table {
 			clearTimeout(collapseNoteTimeout);
 			collapseNoteTimeout = null;
 		}
-		if (cuttingMode) {
+		if (cuttingMode || cuttingOuterMode) {
 			validateCutElement();
 		}
 	}
 
 	function onMouseOver(event) {
-		if (cuttingMode) {
+		if (cuttingMode || cuttingOuterMode) {
 			const target = event.target;
 			if (target.classList) {
 				cuttingPath = getEventPath(event);
@@ -1207,7 +1218,7 @@ table {
 	}
 
 	function onMouseOut() {
-		if (cuttingMode) {
+		if (cuttingMode || cuttingOuterMode) {
 			if (cuttingPath) {
 				unhighlightCutElement();
 				cuttingPath = null;
@@ -1216,7 +1227,7 @@ table {
 	}
 
 	function onKeyDown(event) {
-		if (cuttingMode) {
+		if (cuttingMode || cuttingOuterMode) {
 			if (event.code == "Tab") {
 				if (cuttingPath) {
 					const delta = event.shiftKey ? -1 : 1;
@@ -1262,7 +1273,7 @@ table {
 
 	function highlightCutElement() {
 		const element = cuttingPath[cuttingPathIndex];
-		element.classList.add(CUT_HOVER_CLASS);
+		element.classList.add(cuttingMode ? CUT_HOVER_CLASS : CUT_OUTER_HOVER_CLASS);
 		let parentElement = element.parentElement;
 		while (parentElement && getComputedStyle(parentElement).getPropertyValue("overflow") != "hidden") {
 			parentElement = parentElement.parentElement;
@@ -1278,7 +1289,7 @@ table {
 	function unhighlightCutElement() {
 		if (cuttingPath) {
 			const element = cuttingPath[cuttingPathIndex];
-			element.classList.remove(CUT_HOVER_CLASS);
+			element.classList.remove(cuttingMode ? CUT_HOVER_CLASS : CUT_OUTER_HOVER_CLASS);
 			if (cuttingElementContainer) {
 				cuttingElementContainer.classList.remove(CUT_CONTAINER_HOVER_CLASS);
 			}
@@ -1287,27 +1298,44 @@ table {
 
 	function undoCutPage() {
 		if (removedElementIndex) {
-			removedElements[removedElementIndex - 1].classList.remove(REMOVED_CONTENT_CLASS);
+			removedElements[removedElementIndex - 1].forEach(element => element.classList.remove(REMOVED_CONTENT_CLASS));
 			removedElementIndex--;
 		}
 	}
 
 	function redoCutPage() {
 		if (removedElementIndex < removedElements.length) {
-			removedElements[removedElementIndex].classList.add(REMOVED_CONTENT_CLASS);
+			removedElements[removedElementIndex].forEach(element => element.classList.add(REMOVED_CONTENT_CLASS));
 			removedElementIndex++;
 		}
 	}
 
 	function validateCutElement() {
 		if (cuttingPath) {
-			const element = cuttingPath[cuttingPathIndex];
-			if (document.documentElement != element && element.tagName.toLowerCase() != NOTE_TAGNAME) {
-				element.classList.add(REMOVED_CONTENT_CLASS);
-				removedElements[removedElementIndex] = element;
-				removedElementIndex++;
-				removedElements.length = removedElementIndex;
-				onUpdate(false);
+			if (cuttingMode) {
+				const element = cuttingPath[cuttingPathIndex];
+				if (document.documentElement != element && element.tagName.toLowerCase() != NOTE_TAGNAME) {
+					element.classList.add(REMOVED_CONTENT_CLASS);
+					removedElements[removedElementIndex] = [element];
+					removedElementIndex++;
+					removedElements.length = removedElementIndex;
+					onUpdate(false);
+				}
+			}
+			if (cuttingOuterMode) {
+				const elementKept = cuttingPath[cuttingPathIndex];
+				if (document.documentElement != elementKept && elementKept.tagName.toLowerCase() != NOTE_TAGNAME) {
+					const elements = [];
+					document.body.querySelectorAll("*").forEach(element => {
+						if (elementKept != element && !isAncestor(elementKept, element) && !isAncestor(element, elementKept)) {
+							element.classList.add(REMOVED_CONTENT_CLASS);
+							elements.push(element);
+						}
+					});
+					removedElements[removedElementIndex] = elements;
+					removedElementIndex++;
+					removedElements.length = removedElementIndex;
+				}
 			}
 		}
 	}
@@ -1682,7 +1710,7 @@ table {
 			const onMouseUp = ${minifyText(onMouseUp.toString())};
 			const maskNoteElement = getMaskElement(${JSON.stringify(NOTE_MASK_CLASS)});
 			const maskPageElement = getMaskElement(${JSON.stringify(PAGE_MASK_CLASS)}, ${JSON.stringify(PAGE_MASK_CONTAINER_CLASS)});
-			let selectedNote, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, collapseNoteTimeout, cuttingMode;
+			let selectedNote, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, collapseNoteTimeout, cuttingMode, cuttingOuterMode;
 			window.onresize = reflowNotes;
 			window.onUpdate = () => {};
 			document.documentElement.onmouseup = document.documentElement.ontouchend = onMouseUp;
@@ -1732,4 +1760,8 @@ table {
 		return text.replace(/[\n\t\s]+/g, " ");
 	}
 
+	function isAncestor(element, otherElement) {
+		return otherElement.parentElement && (element == otherElement.parentElement || isAncestor(element, otherElement.parentElement));
+	}
+
 })();

+ 10 - 3
extension/ui/pages/editor-frame-web.css

@@ -53,12 +53,19 @@ single-file-note {
     display: contents !important;
 }
 
-.single-file-hover {
-    outline: 4px dotted red !important;
+.single-file-cut-hover, .single-file-cut-outer-hover {
     transition: outline-width 125ms;
 }
 
-.single-file-hover, .single-file-remove-highlights-mode .single-file-highlight:hover {
+.single-file-cut-hover {
+    outline: 4px dotted red !important;
+}
+
+.single-file-cut-outer-hover {
+    outline: 4px dotted green !important;
+}
+
+.single-file-cut-hover, .single-file-remove-highlights-mode .single-file-highlight:hover {
     cursor: crosshair !important;
 }
 

+ 2 - 2
extension/ui/pages/editor.css

@@ -50,8 +50,8 @@ img[type=button].remove-highlight-disabled {
 
 img[type=button].edit-disabled:hover,
 img[type=button].cut-disabled:hover,
-.toolbar:not(.cut-mode):not(.remove-highlight-mode) img[type=button].highlight-disabled:hover,
-.toolbar:not(.cut-mode) img[type=button].remove-highlight-disabled:hover {
+.toolbar:not(.cut-inner-mode):not(.remove-highlight-mode) img[type=button].highlight-disabled:hover,
+.toolbar:not(.cut-inner-mode) img[type=button].remove-highlight-disabled:hover {
     filter: brightness(0.875);
 }
 

+ 2 - 1
extension/ui/pages/editor.html

@@ -41,7 +41,8 @@
 			<div class="separator"></div>
 		</div>
 		<div class="buttons">
-			<img type="button" class="cut-page-button cut-disabled" src="/extension/ui/resources/button_cut.png">
+			<img type="button" class="cut-inner-page-button cut-disabled" src="/extension/ui/resources/button_cut_inner.png">
+			<img type="button" class="cut-outer-page-button cut-disabled" src="/extension/ui/resources/button_cut_outer.png">
 			<img type="button" class="undo-cut-page-button" src="/extension/ui/resources/button_undo_cut.png">
 			<img type="button" class="undo-all-cut-page-button" src="/extension/ui/resources/button_undo_all_cut.png">
 			<img type="button" class="redo-cut-page-button" src="/extension/ui/resources/button_redo_cut.png">

+ 3 - 3
extension/ui/pages/help.html

@@ -354,8 +354,8 @@
 							<li><code>format the page</code>: enable the button <img
 									src="../resources/button_note_format.png" class="icon"> if the page can be
 								formatted</li>
-							<li><code>remove elements</code>: enable the button <img src="../resources/button_cut.png"
-									class="icon"></li>
+							<li><code>remove elements</code>: enable the button <img
+									src="../resources/button_cut_inner.png" class="icon"></li>
 						</ul>
 						</p>
 					</li>
@@ -707,4 +707,4 @@
 	</div>
 </body>
 
-</html>
+</html>

BIN
extension/ui/resources/button_cut.png


BIN
extension/ui/resources/button_cut_inner.png


BIN
extension/ui/resources/button_cut_outer.png


BIN
extension/ui/resources/button_redo_cut.png