From e36aa30f290413baa5cfe13d8685c8a3e3ead60e Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Fri, 27 May 2022 09:40:25 +0800 Subject: [PATCH 01/10] fix todo bug Signed-off-by: zhanghongchuan33 --- .../component/src/main/ets/components/NoteContent.ets | 8 +++++--- .../src/main/resources/rawfile/rich_editor.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/common/component/src/main/ets/components/NoteContent.ets b/common/component/src/main/ets/components/NoteContent.ets index e5e97a6..0275b54 100644 --- a/common/component/src/main/ets/components/NoteContent.ets +++ b/common/component/src/main/ets/components/NoteContent.ets @@ -117,9 +117,11 @@ export struct NoteContent { .width(StyleConstants.PERCENTAGE_100) .onClick(() => { // 添加定时器:3s自动保存 - timeID = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) - }, 3000) + if (timeID == undefined) { + timeID = setInterval(() => { + this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + }, 3000) + } LogUtil.info(TAG, "setInterval timeID : " + timeID) this.issave = 0 this.editModel = true diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index c8bc40b..ca344c2 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -18,7 +18,12 @@ var RICH_EDITOR = {}; RICH_EDITOR.editor = document.getElementById('editorjs'); RICH_EDITOR.setHtml = function(contents) { - RICH_EDITOR.editor.innerHTML = contents.replace(/'/g, "'"); + var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; + if (base64regex.test(contents)) { + RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents))) + } else { + RICH_EDITOR.editor.innerHTML = contents; + } } RICH_EDITOR.getHtml = function() { @@ -322,7 +327,7 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ function get_html_content() { console.log('get_html_content'); var htmlString = RICH_EDITOR.getHtml() - htmlString = htmlString.replace(/'/g, ''') + htmlString = window.btoa(unescape(encodeURIComponent( htmlString ))) var str = callBackToApp.callbackhtml(htmlString) console.log('get_html_content end'); } @@ -330,7 +335,7 @@ function get_html_content() { function save_html_content() { console.log('save_html_content'); var htmlString = RICH_EDITOR.getHtml() - htmlString = htmlString.replace(/'/g, ''') + htmlString = window.btoa(unescape(encodeURIComponent( htmlString ))) var str = callBackToApp.callbackhtmlSave(htmlString) console.log('save_html_content end'); } -- Gitee From 3487cb1c4b7602560dd3d69e25c40612246a5901 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 10:00:16 +0800 Subject: [PATCH 02/10] fix operateNoteComp bug Signed-off-by: zhanghongchuan33 --- common/component/src/main/ets/components/NoteListComp.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/component/src/main/ets/components/NoteListComp.ets b/common/component/src/main/ets/components/NoteListComp.ets index d773587..7b0ef22 100644 --- a/common/component/src/main/ets/components/NoteListComp.ets +++ b/common/component/src/main/ets/components/NoteListComp.ets @@ -733,7 +733,7 @@ export struct OperateNoteCompForPortrait { }) opacityChange() { - if (this.CheckedNoteArray.length == 0) { + if (this.CheckedNoteArray.length == 0 && this.longpress == true) { this.greyOpacity = true LogUtil.info(TAG, "none checked array") } else { @@ -787,8 +787,8 @@ export struct OperateNoteCompForPortrait { }) } NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.longpress = false + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) -- Gitee From c7e25ced05d7c49a3947cae3c37d66f819712161 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 10:14:22 +0800 Subject: [PATCH 03/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/resources/rawfile/rich_editor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index ca344c2..698e555 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -20,7 +20,7 @@ RICH_EDITOR.editor = document.getElementById('editorjs'); RICH_EDITOR.setHtml = function(contents) { var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; if (base64regex.test(contents)) { - RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents))) + RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents))); } else { RICH_EDITOR.editor.innerHTML = contents; } @@ -326,17 +326,17 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ function get_html_content() { console.log('get_html_content'); - var htmlString = RICH_EDITOR.getHtml() - htmlString = window.btoa(unescape(encodeURIComponent( htmlString ))) - var str = callBackToApp.callbackhtml(htmlString) + var htmlString = RICH_EDITOR.getHtml(); + htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); + var str = callBackToApp.callbackhtml(htmlString); console.log('get_html_content end'); } function save_html_content() { console.log('save_html_content'); - var htmlString = RICH_EDITOR.getHtml() - htmlString = window.btoa(unescape(encodeURIComponent( htmlString ))) - var str = callBackToApp.callbackhtmlSave(htmlString) + var htmlString = RICH_EDITOR.getHtml(); + htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); + var str = callBackToApp.callbackhtmlSave(htmlString); console.log('save_html_content end'); } -- Gitee From 98748bfc5730765a3e82ebc00f285298a9eabf17 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 16:53:59 +0800 Subject: [PATCH 04/10] Fix error Signed-off-by: zhanghongchuan33 --- common/resources/src/main/resources/rawfile/rich_editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 698e555..9b17b72 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -17,7 +17,7 @@ var RICH_EDITOR = {}; RICH_EDITOR.editor = document.getElementById('editorjs'); -RICH_EDITOR.setHtml = function(contents) { +RICH_EDITOR.setHtml = function (contents) { var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; if (base64regex.test(contents)) { RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents))); @@ -26,7 +26,7 @@ RICH_EDITOR.setHtml = function(contents) { } } -RICH_EDITOR.getHtml = function() { +RICH_EDITOR.getHtml = function () { return RICH_EDITOR.editor.innerHTML; } -- Gitee From 0272836f10f49eca9c06c249b3cfb65b8d6f37c2 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 17:20:01 +0800 Subject: [PATCH 05/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/resources/rawfile/rich_editor.js | 190 +++++++++--------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 9b17b72..5bde2c4 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -24,43 +24,43 @@ RICH_EDITOR.setHtml = function (contents) { } else { RICH_EDITOR.editor.innerHTML = contents; } -} +}; RICH_EDITOR.getHtml = function () { return RICH_EDITOR.editor.innerHTML; -} +}; RICH_EDITOR.undo = function() { document.execCommand('undo', false, null); -} +}; -RICH_EDITOR.redo = function() { +RICH_EDITOR.redo = function () { document.execCommand('redo', false, null); -} +}; -RICH_EDITOR.setBold = function() { +RICH_EDITOR.setBold = function () { document.execCommand('bold'); -} +}; -RICH_EDITOR.setItalic = function() { +RICH_EDITOR.setItalic = function () { document.execCommand('italic', false, null); -} +}; -RICH_EDITOR.setSubscript = function() { +RICH_EDITOR.setSubscript = function () { document.execCommand('subscript', false, null); -} +}; -RICH_EDITOR.setSuperscript = function() { +RICH_EDITOR.setSuperscript = function () { document.execCommand('superscript', false, null); -} +}; -RICH_EDITOR.setStrikeThrough = function() { +RICH_EDITOR.setStrikeThrough = function () { document.execCommand('strikeThrough', false, null); -} +}; -RICH_EDITOR.setUnderline = function() { +RICH_EDITOR.setUnderline = function () { document.execCommand('underline', false, null); -} +}; RICH_EDITOR.getListStyle = function () { var selection, type; @@ -73,30 +73,30 @@ RICH_EDITOR.getListStyle = function () { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { if (child.nodeName == "OL") { - console.info('insertOrderedList') + console.info('insertOrderedList'); document.execCommand('insertOrderedList', false, null); - return child.style["list-style"] + return child.style["list-style"]; } if (child.nodeName == "UL") { - console.info('insertUnorderedList') + console.info('insertUnorderedList'); document.execCommand('insertUnorderedList', false, null); - return child.style["list-style"] + return child.style["list-style"]; } if (child.parentNode) { - child = child.parentNode + child = child.parentNode; } } } catch (err) { - console.error(err) + console.error(err); } } -} +}; RICH_EDITOR.setNumbers = function () { - let listStyle = RICH_EDITOR.getListStyle() + let listStyle = RICH_EDITOR.getListStyle(); if(listStyle == "decimal") { - return + return; } document.execCommand('insertOrderedList', false, null); var selection, type; @@ -113,17 +113,17 @@ RICH_EDITOR.setNumbers = function () { break; } if (child.parentNode) { - child = child.parentNode + child = child.parentNode; } } } catch (err) { - console.error(err) + console.error(err); } } -} +}; RICH_EDITOR.setABC = function () { - let listStyle = RICH_EDITOR.getListStyle() + let listStyle = RICH_EDITOR.getListStyle(); if(listStyle == "lower-alpha") { return } @@ -142,19 +142,19 @@ RICH_EDITOR.setABC = function () { break; } if (child.parentNode) { - child = child.parentNode + child = child.parentNode; } } } catch (err) { - console.error(err) + console.error(err); } } -} +}; RICH_EDITOR.setBullets = function () { let listStyle = RICH_EDITOR.getListStyle() if(listStyle == "disc") { - return + return; } document.execCommand('insertUnorderedList', false, null); var selection, type; @@ -171,19 +171,19 @@ RICH_EDITOR.setBullets = function () { break; } if (child.parentNode) { - child = child.parentNode + child = child.parentNode; } } } catch (err) { - console.error(err) + console.error(err); } } -} +}; RICH_EDITOR.setSquare = function () { - let listStyle = RICH_EDITOR.getListStyle() + let listStyle = RICH_EDITOR.getListStyle(); if(listStyle == "square") { - return + return; } document.execCommand('insertUnorderedList', false, null); var selection, type; @@ -200,77 +200,77 @@ RICH_EDITOR.setSquare = function () { break; } if (child.parentNode) { - child = child.parentNode + child = child.parentNode; } } } catch (err) { - console.error(err) + console.error(err); } } -} +}; RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); -} +}; -RICH_EDITOR.setFontSize = function(fontSize){ +RICH_EDITOR.setFontSize = function (fontSize){ document.execCommand("fontSize", false, fontSize); -} +}; RICH_EDITOR.execFontSize = function (size, unit) { document.execCommand("fontSize", false, "7"); - var fontElements = window.getSelection().anchorNode.parentNode + var fontElements = window.getSelection().anchorNode.parentNode; fontElements.removeAttribute("size"); - fontElements.style.fontSize = size + 'px' + fontElements.style.fontSize = size + 'px'; }; var pad = 24 -RICH_EDITOR.setIndent = function() { - var parents = document.getElementById('editorjs') +RICH_EDITOR.setIndent = function () { + var parents = document.getElementById('editorjs'); parents.removeAttribute('padding-left'); - pad = pad + 24 - parents.style.paddingLeft = pad + 'px' -} + pad = pad + 24; + parents.style.paddingLeft = pad + 'px'; +}; RICH_EDITOR.setOutdent = function() { - var parents = document.getElementById('editorjs') + var parents = document.getElementById('editorjs'); parents.removeAttribute('padding-left'); if (pad == 24) { - parents.style.paddingLeft = 24 + 'px' + parents.style.paddingLeft = 24 + 'px'; } else { - pad = pad - 24 - parents.style.paddingLeft = pad + 'px' + pad = pad - 24; + parents.style.paddingLeft = pad + 'px'; } -} +}; -RICH_EDITOR.setJustifyLeft = function() { +RICH_EDITOR.setJustifyLeft = function () { document.execCommand('justifyLeft', false, null); -} +}; -RICH_EDITOR.setJustifyCenter = function() { +RICH_EDITOR.setJustifyCenter = function () { document.execCommand('justifyCenter', false, null); -} +}; -RICH_EDITOR.setJustifyRight = function() { +RICH_EDITOR.setJustifyRight = function () { document.execCommand('justifyRight', false, null); -} +}; -RICH_EDITOR.insertImage = function(url) { +RICH_EDITOR.insertImage = function (url) { var html = '

picvision

'; RICH_EDITOR.insertHTML(html); - RICH_EDITOR.editor.scrollIntoView(false) -} + RICH_EDITOR.editor.scrollIntoView(false); +}; -RICH_EDITOR.insertHTML = function(html) { +RICH_EDITOR.insertHTML = function (html) { document.execCommand('insertHTML', false, html); -} +}; -RICH_EDITOR.setDone = function() { +RICH_EDITOR.setDone = function () { var html = '  '; document.execCommand('insertHTML', false, html); -} +}; -RICH_EDITOR.addTodo=function(e){ +RICH_EDITOR.addTodo = function (e){ KEY_ENTER=13; if(e.which == KEY_ENTER){ var node=RICH_EDITOR.getSelectedAnchorNode(); @@ -282,34 +282,34 @@ RICH_EDITOR.addTodo=function(e){ e.preventDefault(); } } -} +}; RICH_EDITOR.setTodo = function () { - var parent = document.getElementById('editorjs') + var parent = document.getElementById('editorjs'); var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; var html = (isContentEmpty ? '' : '
') + ' '; document.execCommand('insertHTML', false, html); -} +}; -function onCheckChange(checkbox) { +function onCheckChange (checkbox) { if (checkbox.checked == true) { checkbox.setAttribute("checked", "checked"); } else { checkbox.removeAttribute("checked"); } -} +}; -RICH_EDITOR.restorerange = function(){ +RICH_EDITOR.restorerange = function (){ var selection = window.getSelection(); selection.removeAllRanges(); var range = document.createRange(); range.setStart(RICH_EDITOR.currentSelection.startContainer, RICH_EDITOR.currentSelection.startOffset); range.setEnd(RICH_EDITOR.currentSelection.endContainer, RICH_EDITOR.currentSelection.endOffset); selection.addRange(range); -} +}; //获取光标开始位置归属节点 -RICH_EDITOR.getSelectedAnchorNode=function(){ +RICH_EDITOR.getSelectedAnchorNode = function (){ var node,selection; if (window.getSelection) { selection = getSelection(); @@ -322,34 +322,34 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ range.parentElement ? range.parentElement() : range.item(0); } return node; -} +}; -function get_html_content() { +function get_html_content () { console.log('get_html_content'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtml(htmlString); console.log('get_html_content end'); -} +}; -function save_html_content() { +function save_html_content () { console.log('save_html_content'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtmlSave(htmlString); console.log('save_html_content end'); -} +}; -function scheduled_save_content() { - console.info('scheduled_save_content') - var htmlString = RICH_EDITOR.getHtml() - var str = callBackToApp.callbackScheduledSave(htmlString) - console.info('scheduled_save_content end') -} +function scheduled_save_content () { + console.info('scheduled_save_content'); + var htmlString = RICH_EDITOR.getHtml(); + var str = callBackToApp.callbackScheduledSave(htmlString); + console.info('scheduled_save_content end'); +}; -RICH_EDITOR.getFontSizes = function(){ +RICH_EDITOR.getFontSizes = function (){ document.execCommand("fontSize", false, null); - var fontElements = window.getSelection().anchorNode.parentNode - var getSize = fontElements.style.fontSize - var str = callBackToApp.callbackGetSize(getSize) -} \ No newline at end of file + var fontElements = window.getSelection().anchorNode.parentNode; + var getSize = fontElements.style.fontSize; + var str = callBackToApp.callbackGetSize(getSize); +}; \ No newline at end of file -- Gitee From 4537ba192dbc72f4404a1305acb63e4efbceed06 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 17:32:23 +0800 Subject: [PATCH 06/10] fix error Signed-off-by: zhanghongchuan33 --- .../resources/src/main/resources/rawfile/rich_editor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 5bde2c4..df50510 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -297,7 +297,7 @@ function onCheckChange (checkbox) { } else { checkbox.removeAttribute("checked"); } -}; +} RICH_EDITOR.restorerange = function (){ var selection = window.getSelection(); @@ -330,7 +330,7 @@ function get_html_content () { htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtml(htmlString); console.log('get_html_content end'); -}; +} function save_html_content () { console.log('save_html_content'); @@ -338,14 +338,14 @@ function save_html_content () { htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtmlSave(htmlString); console.log('save_html_content end'); -}; +} function scheduled_save_content () { console.info('scheduled_save_content'); var htmlString = RICH_EDITOR.getHtml(); var str = callBackToApp.callbackScheduledSave(htmlString); console.info('scheduled_save_content end'); -}; +} RICH_EDITOR.getFontSizes = function (){ document.execCommand("fontSize", false, null); -- Gitee From a5d94312539f83ae828c9701846979d343f44d25 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 19:06:29 +0800 Subject: [PATCH 07/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/resources/rawfile/rich_editor.js | 113 ++++++++++-------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index df50510..7ad24fe 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -30,7 +30,7 @@ RICH_EDITOR.getHtml = function () { return RICH_EDITOR.editor.innerHTML; }; -RICH_EDITOR.undo = function() { +RICH_EDITOR.undo = function () { document.execCommand('undo', false, null); }; @@ -63,7 +63,8 @@ RICH_EDITOR.setUnderline = function () { }; RICH_EDITOR.getListStyle = function () { - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -72,15 +73,15 @@ RICH_EDITOR.getListStyle = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { + if (child.nodeName == 'OL') { console.info('insertOrderedList'); document.execCommand('insertOrderedList', false, null); - return child.style["list-style"]; + return child.style['list-style']; } - if (child.nodeName == "UL") { + if (child.nodeName == 'UL') { console.info('insertUnorderedList'); document.execCommand('insertUnorderedList', false, null); - return child.style["list-style"]; + return child.style['list-style']; } if (child.parentNode) { child = child.parentNode; @@ -95,11 +96,12 @@ RICH_EDITOR.getListStyle = function () { RICH_EDITOR.setNumbers = function () { let listStyle = RICH_EDITOR.getListStyle(); - if(listStyle == "decimal") { + if (listStyle == 'decimal') { return; } document.execCommand('insertOrderedList', false, null); - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -108,8 +110,8 @@ RICH_EDITOR.setNumbers = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { - child.style["list-style"] = "decimal"; + if (child.nodeName == 'OL') { + child.style["list-style"] = 'decimal'; break; } if (child.parentNode) { @@ -124,11 +126,12 @@ RICH_EDITOR.setNumbers = function () { RICH_EDITOR.setABC = function () { let listStyle = RICH_EDITOR.getListStyle(); - if(listStyle == "lower-alpha") { - return + if (listStyle == 'lower-alpha') { + return; } document.execCommand('insertOrderedList', false, null); - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -137,8 +140,8 @@ RICH_EDITOR.setABC = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { - child.style["list-style"] = "lower-alpha"; + if (child.nodeName == 'OL') { + child.style["list-style"] = 'lower-alpha'; break; } if (child.parentNode) { @@ -152,12 +155,13 @@ RICH_EDITOR.setABC = function () { }; RICH_EDITOR.setBullets = function () { - let listStyle = RICH_EDITOR.getListStyle() - if(listStyle == "disc") { + let listStyle = RICH_EDITOR.getListStyle(); + if (listStyle == 'disc') { return; } document.execCommand('insertUnorderedList', false, null); - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -166,8 +170,8 @@ RICH_EDITOR.setBullets = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "UL") { - child.style["list-style"] = "disc"; + if (child.nodeName == 'UL') { + child.style['list-style'] = 'disc'; break; } if (child.parentNode) { @@ -182,11 +186,12 @@ RICH_EDITOR.setBullets = function () { RICH_EDITOR.setSquare = function () { let listStyle = RICH_EDITOR.getListStyle(); - if(listStyle == "square") { + if (listStyle == 'square') { return; } document.execCommand('insertUnorderedList', false, null); - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -195,8 +200,8 @@ RICH_EDITOR.setSquare = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "UL") { - child.style["list-style"] = "square"; + if (child.nodeName == 'UL') { + child.style['list-style'] = 'square'; break; } if (child.parentNode) { @@ -213,18 +218,18 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); }; -RICH_EDITOR.setFontSize = function (fontSize){ - document.execCommand("fontSize", false, fontSize); +RICH_EDITOR.setFontSize = function (fontSize) { + document.execCommand('fontSize', false, fontSize); }; RICH_EDITOR.execFontSize = function (size, unit) { - document.execCommand("fontSize", false, "7"); + document.execCommand('fontSize', false, "7"); var fontElements = window.getSelection().anchorNode.parentNode; - fontElements.removeAttribute("size"); + fontElements.removeAttribute('size'); fontElements.style.fontSize = size + 'px'; }; -var pad = 24 +var pad = 24; RICH_EDITOR.setIndent = function () { var parents = document.getElementById('editorjs'); parents.removeAttribute('padding-left'); @@ -232,7 +237,7 @@ RICH_EDITOR.setIndent = function () { parents.style.paddingLeft = pad + 'px'; }; -RICH_EDITOR.setOutdent = function() { +RICH_EDITOR.setOutdent = function () { var parents = document.getElementById('editorjs'); parents.removeAttribute('padding-left'); if (pad == 24) { @@ -256,7 +261,8 @@ RICH_EDITOR.setJustifyRight = function () { }; RICH_EDITOR.insertImage = function (url) { - var html = '

picvision

'; + var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false); }; @@ -270,14 +276,14 @@ RICH_EDITOR.setDone = function () { document.execCommand('insertHTML', false, html); }; -RICH_EDITOR.addTodo = function (e){ - KEY_ENTER=13; - if(e.which == KEY_ENTER){ - var node=RICH_EDITOR.getSelectedAnchorNode(); - if(node&&node.nodeName=="#text"){ - node=node.parentElement; +RICH_EDITOR.addTodo = function (e) { + KEY_ENTER = 13; + if (e.which == KEY_ENTER) { + var node = RICH_EDITOR.getSelectedAnchorNode(); + if (node && node.nodeName == "#text") { + node = node.parentElement; } - if(node&&node.nodeName=="SPAN"&&node.previousElementSibling&&node.previousElementSibling.className=='note-checkbox'){ + if (node && node.nodeName == 'SPAN' && node.previousElementSibling && node.previousElementSibling.className == 'note-checkbox') { RICH_EDITOR.setTodo(); e.preventDefault(); } @@ -287,19 +293,20 @@ RICH_EDITOR.addTodo = function (e){ RICH_EDITOR.setTodo = function () { var parent = document.getElementById('editorjs'); var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; - var html = (isContentEmpty ? '' : '
') + ' '; + var html = (isContentEmpty ? '' : '
') + + ' '; document.execCommand('insertHTML', false, html); }; -function onCheckChange (checkbox) { +function onCheckChange(checkbox) { if (checkbox.checked == true) { - checkbox.setAttribute("checked", "checked"); + checkbox.setAttribute('checked', 'checked'); } else { - checkbox.removeAttribute("checked"); + checkbox.removeAttribute('checked'); } } -RICH_EDITOR.restorerange = function (){ +RICH_EDITOR.restorerange = function () { var selection = window.getSelection(); selection.removeAllRanges(); var range = document.createRange(); @@ -309,22 +316,22 @@ RICH_EDITOR.restorerange = function (){ }; //获取光标开始位置归属节点 -RICH_EDITOR.getSelectedAnchorNode = function (){ - var node,selection; +RICH_EDITOR.getSelectedAnchorNode = function () { + var node; + var selection; if (window.getSelection) { selection = getSelection(); node = selection.anchorNode; } if (!node && document.selection) { - selection = document.selection + selection = document.selection; var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); - node = range.commonAncestorContainer ? range.commonAncestorContainer : - range.parentElement ? range.parentElement() : range.item(0); + node = range.commonAncestorContainer ? range.commonAncestorContainer : range.parentElement ? range.parentElement() : range.item(0); } return node; }; -function get_html_content () { +function get_html_content() { console.log('get_html_content'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); @@ -332,7 +339,7 @@ function get_html_content () { console.log('get_html_content end'); } -function save_html_content () { +function save_html_content() { console.log('save_html_content'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); @@ -340,15 +347,15 @@ function save_html_content () { console.log('save_html_content end'); } -function scheduled_save_content () { +function scheduled_save_content() { console.info('scheduled_save_content'); var htmlString = RICH_EDITOR.getHtml(); var str = callBackToApp.callbackScheduledSave(htmlString); console.info('scheduled_save_content end'); } -RICH_EDITOR.getFontSizes = function (){ - document.execCommand("fontSize", false, null); +RICH_EDITOR.getFontSizes = function () { + document.execCommand('fontSize', false, null); var fontElements = window.getSelection().anchorNode.parentNode; var getSize = fontElements.style.fontSize; var str = callBackToApp.callbackGetSize(getSize); -- Gitee From a86c1f5290cd2b7ef40afefebaf12ea9ec731b6b Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Mon, 30 May 2022 19:11:25 +0800 Subject: [PATCH 08/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/resources/rawfile/rich_editor.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 7ad24fe..74f561b 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -111,7 +111,7 @@ RICH_EDITOR.setNumbers = function () { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { if (child.nodeName == 'OL') { - child.style["list-style"] = 'decimal'; + child.style['list-style'] = 'decimal'; break; } if (child.parentNode) { @@ -141,7 +141,7 @@ RICH_EDITOR.setABC = function () { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { if (child.nodeName == 'OL') { - child.style["list-style"] = 'lower-alpha'; + child.style['list-style'] = 'lower-alpha'; break; } if (child.parentNode) { @@ -223,7 +223,7 @@ RICH_EDITOR.setFontSize = function (fontSize) { }; RICH_EDITOR.execFontSize = function (size, unit) { - document.execCommand('fontSize', false, "7"); + document.execCommand('fontSize', false, '7'); var fontElements = window.getSelection().anchorNode.parentNode; fontElements.removeAttribute('size'); fontElements.style.fontSize = size + 'px'; @@ -261,8 +261,8 @@ RICH_EDITOR.setJustifyRight = function () { }; RICH_EDITOR.insertImage = function (url) { - var html = '

picvision

'; + var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false); }; @@ -280,7 +280,7 @@ RICH_EDITOR.addTodo = function (e) { KEY_ENTER = 13; if (e.which == KEY_ENTER) { var node = RICH_EDITOR.getSelectedAnchorNode(); - if (node && node.nodeName == "#text") { + if (node && node.nodeName == '#text') { node = node.parentElement; } if (node && node.nodeName == 'SPAN' && node.previousElementSibling && node.previousElementSibling.className == 'note-checkbox') { @@ -293,8 +293,8 @@ RICH_EDITOR.addTodo = function (e) { RICH_EDITOR.setTodo = function () { var parent = document.getElementById('editorjs'); var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; - var html = (isContentEmpty ? '' : '
') + - ' '; + var html = (isContentEmpty ? '' : '
') + + ' '; document.execCommand('insertHTML', false, html); }; @@ -316,6 +316,7 @@ RICH_EDITOR.restorerange = function () { }; //获取光标开始位置归属节点 + RICH_EDITOR.getSelectedAnchorNode = function () { var node; var selection; -- Gitee From 70d3b44c10b5aadd96f6d89dea60ad76e3517881 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Tue, 31 May 2022 10:17:12 +0800 Subject: [PATCH 09/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/resources/rawfile/rich_editor.js | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 74f561b..aade4c5 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -1,4 +1,4 @@ -/* +/* @file * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,12 +73,12 @@ RICH_EDITOR.getListStyle = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == 'OL') { + if (child.nodeName === 'OL') { console.info('insertOrderedList'); document.execCommand('insertOrderedList', false, null); return child.style['list-style']; } - if (child.nodeName == 'UL') { + if (child.nodeName === 'UL') { console.info('insertUnorderedList'); document.execCommand('insertUnorderedList', false, null); return child.style['list-style']; @@ -96,7 +96,7 @@ RICH_EDITOR.getListStyle = function () { RICH_EDITOR.setNumbers = function () { let listStyle = RICH_EDITOR.getListStyle(); - if (listStyle == 'decimal') { + if (listStyle === 'decimal') { return; } document.execCommand('insertOrderedList', false, null); @@ -110,7 +110,7 @@ RICH_EDITOR.setNumbers = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == 'OL') { + if (child.nodeName === 'OL') { child.style['list-style'] = 'decimal'; break; } @@ -126,7 +126,7 @@ RICH_EDITOR.setNumbers = function () { RICH_EDITOR.setABC = function () { let listStyle = RICH_EDITOR.getListStyle(); - if (listStyle == 'lower-alpha') { + if (listStyle === 'lower-alpha') { return; } document.execCommand('insertOrderedList', false, null); @@ -140,7 +140,7 @@ RICH_EDITOR.setABC = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == 'OL') { + if (child.nodeName === 'OL') { child.style['list-style'] = 'lower-alpha'; break; } @@ -156,7 +156,7 @@ RICH_EDITOR.setABC = function () { RICH_EDITOR.setBullets = function () { let listStyle = RICH_EDITOR.getListStyle(); - if (listStyle == 'disc') { + if (listStyle === 'disc') { return; } document.execCommand('insertUnorderedList', false, null); @@ -170,7 +170,7 @@ RICH_EDITOR.setBullets = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == 'UL') { + if (child.nodeName === 'UL') { child.style['list-style'] = 'disc'; break; } @@ -186,7 +186,7 @@ RICH_EDITOR.setBullets = function () { RICH_EDITOR.setSquare = function () { let listStyle = RICH_EDITOR.getListStyle(); - if (listStyle == 'square') { + if (listStyle === 'square') { return; } document.execCommand('insertUnorderedList', false, null); @@ -200,7 +200,7 @@ RICH_EDITOR.setSquare = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == 'UL') { + if (child.nodeName === 'UL') { child.style['list-style'] = 'square'; break; } @@ -240,7 +240,7 @@ RICH_EDITOR.setIndent = function () { RICH_EDITOR.setOutdent = function () { var parents = document.getElementById('editorjs'); parents.removeAttribute('padding-left'); - if (pad == 24) { + if (pad === 24) { parents.style.paddingLeft = 24 + 'px'; } else { pad = pad - 24; @@ -262,7 +262,8 @@ RICH_EDITOR.setJustifyRight = function () { RICH_EDITOR.insertImage = function (url) { var html = '

picvision

'; + + '" alt="picvision" style="margin:0px auto;width:90%;display:table-cell;' + + 'vertical-align:middle;border-radius:10px;max-width:90%" />

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false); }; @@ -277,13 +278,15 @@ RICH_EDITOR.setDone = function () { }; RICH_EDITOR.addTodo = function (e) { + var KEY_ENTER; KEY_ENTER = 13; - if (e.which == KEY_ENTER) { + if (e.which === KEY_ENTER) { var node = RICH_EDITOR.getSelectedAnchorNode(); - if (node && node.nodeName == '#text') { + if (node && node.nodeName === '#text') { node = node.parentElement; } - if (node && node.nodeName == 'SPAN' && node.previousElementSibling && node.previousElementSibling.className == 'note-checkbox') { + if (node && node.nodeName === 'SPAN' && node.previousElementSibling + && node.previousElementSibling.className === 'note-checkbox') { RICH_EDITOR.setTodo(); e.preventDefault(); } @@ -292,14 +295,15 @@ RICH_EDITOR.addTodo = function (e) { RICH_EDITOR.setTodo = function () { var parent = document.getElementById('editorjs'); - var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; + var isContentEmpty = parent.innerHTML.trim().length === 0 || parent.innerHTML === '
'; var html = (isContentEmpty ? '' : '
') - + ' '; + + '' + + ' '; document.execCommand('insertHTML', false, html); }; function onCheckChange(checkbox) { - if (checkbox.checked == true) { + if (checkbox.checked === true) { checkbox.setAttribute('checked', 'checked'); } else { checkbox.removeAttribute('checked'); @@ -315,7 +319,7 @@ RICH_EDITOR.restorerange = function () { selection.addRange(range); }; -//获取光标开始位置归属节点 +// 获取光标开始位置归属节点 RICH_EDITOR.getSelectedAnchorNode = function () { var node; @@ -327,7 +331,8 @@ RICH_EDITOR.getSelectedAnchorNode = function () { if (!node && document.selection) { selection = document.selection; var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); - node = range.commonAncestorContainer ? range.commonAncestorContainer : range.parentElement ? range.parentElement() : range.item(0); + node = range.commonAncestorContainer ? range.commonAncestorContainer : range.parentElement + ? range.parentElement() : range.item(0); } return node; }; -- Gitee From eea05e1038da0df421938be3a7af74fee4de99d2 Mon Sep 17 00:00:00 2001 From: zhanghongchuan33 Date: Tue, 31 May 2022 10:35:57 +0800 Subject: [PATCH 10/10] fix error Signed-off-by: zhanghongchuan33 --- .../src/main/ets/components/NoteContent.ets | 6 +++--- .../main/ets/components/NoteContentComp.ets | 6 +++--- .../components/NoteContentCompPortrait.ets | 6 +++--- .../src/main/resources/rawfile/rich_editor.js | 20 +++++++++---------- .../src/main/ets/pages/NoteContentHome.ets | 2 +- .../src/main/ets/pages/NoteContentHome.ets | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/common/component/src/main/ets/components/NoteContent.ets b/common/component/src/main/ets/components/NoteContent.ets index 0275b54..b3a8ad8 100644 --- a/common/component/src/main/ets/components/NoteContent.ets +++ b/common/component/src/main/ets/components/NoteContent.ets @@ -119,7 +119,7 @@ export struct NoteContent { // 添加定时器:3s自动保存 if (timeID == undefined) { timeID = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) }, 3000) } LogUtil.info(TAG, "setInterval timeID : " + timeID) @@ -169,7 +169,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) // 清除定时器 if (timeID != undefined) { LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID) @@ -302,7 +302,7 @@ export struct ToolBarComp { .onClick(() => { this.issave = 1 // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) }) }.width(42) .height(42) diff --git a/common/component/src/main/ets/components/NoteContentComp.ets b/common/component/src/main/ets/components/NoteContentComp.ets index 1e5c517..a805d36 100644 --- a/common/component/src/main/ets/components/NoteContentComp.ets +++ b/common/component/src/main/ets/components/NoteContentComp.ets @@ -164,7 +164,7 @@ export struct NoteContentComp { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) // 添加定时器:3s自动保存 timeId = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) }, 3000) LogUtil.info(TAG, "setInterval timeId : " + timeId) // save continue data @@ -376,7 +376,7 @@ export struct ToolBarComp { this.sectionStatus = this.lastSectionStatus // 退出全屏时存库 LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) - this.controllerShow.runJavaScript({ script: "save_html_content()" }) + this.controllerShow.runJavaScript({ script: "saveHtmlContent()" }) //退出键盘 inputMethod.getInputMethodController().stopInput(); // 清除定时器 @@ -532,7 +532,7 @@ export struct ToolBarComp { .fillColor(this.issave == 0 ? Color.Black : Color.Grey) .onClick(() => { // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { LogUtil.info(TAG, "note is empty,save note failed") } diff --git a/common/component/src/main/ets/components/NoteContentCompPortrait.ets b/common/component/src/main/ets/components/NoteContentCompPortrait.ets index c73e6de..a3bef82 100644 --- a/common/component/src/main/ets/components/NoteContentCompPortrait.ets +++ b/common/component/src/main/ets/components/NoteContentCompPortrait.ets @@ -122,7 +122,7 @@ export struct NoteContentCompPortrait { .onClick(() => { // 添加定时器:3s自动保存 time_id = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) }, 3000) LogUtil.info(TAG, "setInterval time_id : " + time_id) this.editModel = true @@ -296,7 +296,7 @@ export struct ToolBarComp { .width(24) .responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 }) .onClick(() => { - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) // 清除定时器 if (time_id != undefined) { LogUtil.info(TAG, "back, clearInterval time_id : " + time_id) @@ -359,7 +359,7 @@ export struct ToolBarComp { Image($r('app.media.tick_thin')).height(24).width(24) .onClick(() => { // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) this.editModel = false }) }.width(42) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index aade4c5..1b0c41e 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -336,28 +336,28 @@ RICH_EDITOR.getSelectedAnchorNode = function () { } return node; }; - -function get_html_content() { - console.log('get_html_content'); +var callBackToApp; +function getHtmlContent() { + console.log('getHtmlContent'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtml(htmlString); - console.log('get_html_content end'); + console.log('getHtmlContent end'); } -function save_html_content() { - console.log('save_html_content'); +function saveHtmlContent() { + console.log('saveHtmlContent'); var htmlString = RICH_EDITOR.getHtml(); htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); var str = callBackToApp.callbackhtmlSave(htmlString); - console.log('save_html_content end'); + console.log('saveHtmlContent end'); } -function scheduled_save_content() { - console.info('scheduled_save_content'); +function scheduledSaveContent() { + console.info('scheduledSaveContent'); var htmlString = RICH_EDITOR.getHtml(); var str = callBackToApp.callbackScheduledSave(htmlString); - console.info('scheduled_save_content end'); + console.info('scheduledSaveContent end'); } RICH_EDITOR.getFontSizes = function () { diff --git a/product/phone/src/main/ets/pages/NoteContentHome.ets b/product/phone/src/main/ets/pages/NoteContentHome.ets index 89a4853..d12a18e 100644 --- a/product/phone/src/main/ets/pages/NoteContentHome.ets +++ b/product/phone/src/main/ets/pages/NoteContentHome.ets @@ -40,7 +40,7 @@ struct NoteContentHome { onBackPress():void{ LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) } aboutToAppear(): void{ diff --git a/product/tablet/src/main/ets/pages/NoteContentHome.ets b/product/tablet/src/main/ets/pages/NoteContentHome.ets index 2dc3305..861a478 100644 --- a/product/tablet/src/main/ets/pages/NoteContentHome.ets +++ b/product/tablet/src/main/ets/pages/NoteContentHome.ets @@ -40,7 +40,7 @@ struct NoteContentHome { onBackPress():void{ LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) inputMethod.getInputMethodController().stopInput() } -- Gitee