瀏覽代碼

test if there is an highighted element

Gildas 5 年之前
父節點
當前提交
ba0e98a2cb
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      extension/ui/content/content-ui-editor-web.js

+ 6 - 4
extension/ui/content/content-ui-editor-web.js

@@ -1254,10 +1254,12 @@ table {
 	}
 
 	function unhighlightCutElement() {
-		const element = cuttingPath[cuttingPathIndex];
-		element.classList.remove(CUT_HOVER_CLASS);
-		if (cuttingElementContainer) {
-			cuttingElementContainer.classList.remove(CUT_CONTAINER_HOVER_CLASS);
+		if (cuttingPath) {
+			const element = cuttingPath[cuttingPathIndex];
+			element.classList.remove(CUT_HOVER_CLASS);
+			if (cuttingElementContainer) {
+				cuttingElementContainer.classList.remove(CUT_CONTAINER_HOVER_CLASS);
+			}
 		}
 	}