fix error

Signed-off-by: zhanghongchuan33 <zhanghongchuan6@huawei.com>
This commit is contained in:
zhanghongchuan33
2022-05-31 10:35:57 +08:00
parent 66d17543e7
commit 953fd75a05
6 changed files with 21 additions and 21 deletions
@@ -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)
@@ -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")
}
@@ -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)
@@ -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 () {
@@ -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{
@@ -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()
}