mirror of
https://github.com/openharmony/applications_notes.git
synced 2026-07-18 18:24:27 -04:00
@@ -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: "scheduledSaveContent()" })
|
||||
}, 3000)
|
||||
}
|
||||
LogUtil.info(TAG, "setInterval timeID : " + timeID)
|
||||
this.issave = 0
|
||||
this.editModel = true
|
||||
@@ -167,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)
|
||||
@@ -300,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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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.
|
||||
@@ -17,48 +17,54 @@ var RICH_EDITOR = {};
|
||||
|
||||
RICH_EDITOR.editor = document.getElementById('editorjs');
|
||||
|
||||
RICH_EDITOR.setHtml = function(contents) {
|
||||
RICH_EDITOR.editor.innerHTML = contents.replace(/'/g, "'");
|
||||
}
|
||||
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)));
|
||||
} else {
|
||||
RICH_EDITOR.editor.innerHTML = contents;
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.getHtml = function() {
|
||||
RICH_EDITOR.getHtml = function () {
|
||||
return RICH_EDITOR.editor.innerHTML;
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.undo = function() {
|
||||
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;
|
||||
var selection;
|
||||
var type;
|
||||
if (window.getSelection) {
|
||||
selection = getSelection();
|
||||
}
|
||||
@@ -67,34 +73,35 @@ RICH_EDITOR.getListStyle = function () {
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName == "OL") {
|
||||
console.info('insertOrderedList')
|
||||
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") {
|
||||
console.info('insertUnorderedList')
|
||||
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
|
||||
child = child.parentNode;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.setNumbers = function () {
|
||||
let listStyle = RICH_EDITOR.getListStyle()
|
||||
if(listStyle == "decimal") {
|
||||
return
|
||||
let listStyle = RICH_EDITOR.getListStyle();
|
||||
if (listStyle === 'decimal') {
|
||||
return;
|
||||
}
|
||||
document.execCommand('insertOrderedList', false, null);
|
||||
var selection, type;
|
||||
var selection;
|
||||
var type;
|
||||
if (window.getSelection) {
|
||||
selection = getSelection();
|
||||
}
|
||||
@@ -103,27 +110,28 @@ 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) {
|
||||
child = child.parentNode
|
||||
child = child.parentNode;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.setABC = function () {
|
||||
let listStyle = RICH_EDITOR.getListStyle()
|
||||
if(listStyle == "lower-alpha") {
|
||||
return
|
||||
let listStyle = RICH_EDITOR.getListStyle();
|
||||
if (listStyle === 'lower-alpha') {
|
||||
return;
|
||||
}
|
||||
document.execCommand('insertOrderedList', false, null);
|
||||
var selection, type;
|
||||
var selection;
|
||||
var type;
|
||||
if (window.getSelection) {
|
||||
selection = getSelection();
|
||||
}
|
||||
@@ -132,27 +140,28 @@ 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) {
|
||||
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
|
||||
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();
|
||||
}
|
||||
@@ -161,27 +170,28 @@ 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) {
|
||||
child = child.parentNode
|
||||
child = child.parentNode;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.setSquare = function () {
|
||||
let listStyle = RICH_EDITOR.getListStyle()
|
||||
if(listStyle == "square") {
|
||||
return
|
||||
let listStyle = RICH_EDITOR.getListStyle();
|
||||
if (listStyle === 'square') {
|
||||
return;
|
||||
}
|
||||
document.execCommand('insertUnorderedList', false, null);
|
||||
var selection, type;
|
||||
var selection;
|
||||
var type;
|
||||
if (window.getSelection) {
|
||||
selection = getSelection();
|
||||
}
|
||||
@@ -190,161 +200,169 @@ 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) {
|
||||
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){
|
||||
document.execCommand("fontSize", false, fontSize);
|
||||
}
|
||||
|
||||
RICH_EDITOR.execFontSize = function (size, unit) {
|
||||
document.execCommand("fontSize", false, "7");
|
||||
var fontElements = window.getSelection().anchorNode.parentNode
|
||||
fontElements.removeAttribute("size");
|
||||
fontElements.style.fontSize = size + 'px'
|
||||
};
|
||||
|
||||
var pad = 24
|
||||
RICH_EDITOR.setIndent = function() {
|
||||
var parents = document.getElementById('editorjs')
|
||||
parents.removeAttribute('padding-left');
|
||||
pad = pad + 24
|
||||
parents.style.paddingLeft = pad + 'px'
|
||||
}
|
||||
RICH_EDITOR.setFontSize = function (fontSize) {
|
||||
document.execCommand('fontSize', false, fontSize);
|
||||
};
|
||||
|
||||
RICH_EDITOR.setOutdent = function() {
|
||||
var parents = document.getElementById('editorjs')
|
||||
RICH_EDITOR.execFontSize = function (size, unit) {
|
||||
document.execCommand('fontSize', false, '7');
|
||||
var fontElements = window.getSelection().anchorNode.parentNode;
|
||||
fontElements.removeAttribute('size');
|
||||
fontElements.style.fontSize = size + 'px';
|
||||
};
|
||||
|
||||
var pad = 24;
|
||||
RICH_EDITOR.setIndent = function () {
|
||||
var parents = document.getElementById('editorjs');
|
||||
parents.removeAttribute('padding-left');
|
||||
if (pad == 24) {
|
||||
parents.style.paddingLeft = 24 + 'px'
|
||||
pad = pad + 24;
|
||||
parents.style.paddingLeft = pad + 'px';
|
||||
};
|
||||
|
||||
RICH_EDITOR.setOutdent = function () {
|
||||
var parents = document.getElementById('editorjs');
|
||||
parents.removeAttribute('padding-left');
|
||||
if (pad === 24) {
|
||||
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) {
|
||||
var html = '<br></br><img src="' + url + '" alt="picvision" style="margin:0px auto;width:90%;display:table-cell;vertical-align:middle;border-radius:10px;max-width:90%" /><br></br>';
|
||||
RICH_EDITOR.insertImage = function (url) {
|
||||
var html = '<br></br><img src="' + url
|
||||
+ '" alt="picvision" style="margin:0px auto;width:90%;display:table-cell;'
|
||||
+ 'vertical-align:middle;border-radius:10px;max-width:90%" /><br></br>';
|
||||
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 = '<input type="checkbox" checked="checked"/> ';
|
||||
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) {
|
||||
var KEY_ENTER;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RICH_EDITOR.setTodo = function () {
|
||||
var parent = document.getElementById('editorjs')
|
||||
var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '<br>';
|
||||
var html = (isContentEmpty ? '' : '<br/>') + '<input name="checkbox" type="checkbox" onclick="onCheckChange(this)" class="note-checkbox"><span class="note-checkbox-txt"> </span>';
|
||||
var parent = document.getElementById('editorjs');
|
||||
var isContentEmpty = parent.innerHTML.trim().length === 0 || parent.innerHTML === '<br>';
|
||||
var html = (isContentEmpty ? '' : '<br/>')
|
||||
+ '<input name="checkbox" type="checkbox" onclick="onCheckChange(this)" class="note-checkbox">'
|
||||
+ '<span class="note-checkbox-txt"> </span>';
|
||||
document.execCommand('insertHTML', false, html);
|
||||
}
|
||||
};
|
||||
|
||||
function onCheckChange(checkbox) {
|
||||
if (checkbox.checked == true) {
|
||||
checkbox.setAttribute("checked", "checked");
|
||||
if (checkbox.checked === true) {
|
||||
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();
|
||||
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(){
|
||||
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;
|
||||
};
|
||||
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('getHtmlContent end');
|
||||
}
|
||||
|
||||
function get_html_content() {
|
||||
console.log('get_html_content');
|
||||
var htmlString = RICH_EDITOR.getHtml()
|
||||
htmlString = htmlString.replace(/'/g, ''')
|
||||
var str = callBackToApp.callbackhtml(htmlString)
|
||||
console.log('get_html_content end');
|
||||
function saveHtmlContent() {
|
||||
console.log('saveHtmlContent');
|
||||
var htmlString = RICH_EDITOR.getHtml();
|
||||
htmlString = window.btoa(unescape(encodeURIComponent(htmlString)));
|
||||
var str = callBackToApp.callbackhtmlSave(htmlString);
|
||||
console.log('saveHtmlContent end');
|
||||
}
|
||||
|
||||
function save_html_content() {
|
||||
console.log('save_html_content');
|
||||
var htmlString = RICH_EDITOR.getHtml()
|
||||
htmlString = htmlString.replace(/'/g, ''')
|
||||
var str = callBackToApp.callbackhtmlSave(htmlString)
|
||||
console.log('save_html_content end');
|
||||
function scheduledSaveContent() {
|
||||
console.info('scheduledSaveContent');
|
||||
var htmlString = RICH_EDITOR.getHtml();
|
||||
var str = callBackToApp.callbackScheduledSave(htmlString);
|
||||
console.info('scheduledSaveContent 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);
|
||||
var fontElements = window.getSelection().anchorNode.parentNode
|
||||
var getSize = fontElements.style.fontSize
|
||||
var str = callBackToApp.callbackGetSize(getSize)
|
||||
}
|
||||
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);
|
||||
};
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user