A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix image styles not saved
ammarahm-edc319063f9648
diff --git a/apps/mobile/android/app/src/main/assets/index.html b/apps/mobile/android/app/src/main/assets/index.htmlindex 0721dc5e8..8045ac712 100644--- a/apps/mobile/android/app/src/main/assets/index.html+++ b/apps/mobile/android/app/src/main/assets/index.html@@ -38,7 +38,6 @@<script src="./constants.js"></script><script src="./init.js"></script><script>-attachMessageListener()init_tiny("calc(100vh - 55px)");</script>diff --git a/apps/mobile/android/app/src/main/assets/init.js b/apps/mobile/android/app/src/main/assets/init.jsindex e8aa77f65..de96d255c 100755--- a/apps/mobile/android/app/src/main/assets/init.js+++ b/apps/mobile/android/app/src/main/assets/init.js@@ -35,6 +35,24 @@ function init_tiny(size) {textpattern_patterns: markdownPatterns,contextmenu: false,content_style: `+ .img_float_left {+ float:left;+ }+ .img_float_right {+ float:right;+ }+ .img_float_none {+ float:none;+ }+ .img_size_one {+ width:100%;+ }+ .img_size_two {+ width:50%;+ }+ .img_size_three {+ width:25%;+ }span.diff-del {background-color: #FDB0C0;}@@ -185,9 +203,6 @@ function init_tiny(size) {}window.prevContent = '';const onChange = function (event) {- console.log('changed');--if (event.type === 'nodechange' && !event.selectionChange) return;if (isLoading) {isLoading = false;@@ -196,15 +211,13 @@ const onChange = function (event) {if (editor.plugins.wordcount.getCount() === 0) return;clearTimeout(changeTimer);changeTimer = null;- changeTimer = setTimeout(function () {- selectchange();- console.log('saving')- reactNativeEventHandler('tiny', editor.getContent());-- reactNativeEventHandler('history', {- undo: editor.undoManager.hasUndo(),- redo: editor.undoManager.hasRedo()- });+ changeTimer = setTimeout(function () {+ selectchange();+ reactNativeEventHandler('tiny', editor.getContent());+ reactNativeEventHandler('history', {+ undo: editor.undoManager.hasUndo(),+ redo: editor.undoManager.hasRedo()+ });}, 1);};diff --git a/apps/mobile/html/Web.bundle/site/init.js b/apps/mobile/html/Web.bundle/site/init.jsindex 46a2746a2..de96d255c 100755--- a/apps/mobile/html/Web.bundle/site/init.js+++ b/apps/mobile/html/Web.bundle/site/init.js@@ -35,6 +35,24 @@ function init_tiny(size) {textpattern_patterns: markdownPatterns,contextmenu: false,content_style: `+ .img_float_left {+ float:left;+ }+ .img_float_right {+ float:right;+ }+ .img_float_none {+ float:none;+ }+ .img_size_one {+ width:100%;+ }+ .img_size_two {+ width:50%;+ }+ .img_size_three {+ width:25%;+ }span.diff-del {background-color: #FDB0C0;}diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex cdf64406b..310b1bb05 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -328,6 +328,11 @@ export const _onMessage = async evt => {editing.tooltip = 'imageoptions';eSendEvent('showTooltip', {data: [+ {+ format: 'imagepreview',+ type: 'format',+ fullname: 'Image preview',+ },{format: 'imageResize25',text: '25%',@@ -350,15 +355,25 @@ export const _onMessage = async evt => {fullname: 'Resize to 25%',},{- format: 'removeimage',+ format: 'imagefloatleft',type: 'format',fullname: 'Remove image',},{- format: 'imagepreview',+ format: 'imagefloatright',+ type: 'format',+ fullname: 'Image preview',+ },+ {+ format: 'imagefloatnone',type: 'format',fullname: 'Image preview',},+ {+ format: 'removeimage',+ type: 'format',+ fullname: 'Remove image',+ },],title: 'imageoptions',default: null,diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js b/apps/mobile/src/views/Editor/tiny/toolbar/commands.jsindex 05e241b81..dcb4d8f00 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/commands.js@@ -131,20 +131,59 @@ export const execCommands = {tablesplitcell: "tinymce.activeEditor.execCommand('mceTableSplitCells');",tablemergecell: "tinymce.activeEditor.execCommand('mceTableMergeCells');",tablerowprops: "tinymce.activeEditor.execCommand('mceTableRowProps');",- imageResize25: `+ imageResize25: `(function() {+ let node = tinymce.activeEditor.selection.getNode();if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {- tinymce.activeEditor.selection.getNode().style.width = "25%";++ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_one")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_one")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_two")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_two")+ }+ tinymce.activeEditor.dom.addClass(node,"img_size_three")+ });++ tinymce.activeEditor.nodeChanged()}++ })();+`,- imageResize50: `+ imageResize50: `(function() {+ let node = tinymce.activeEditor.selection.getNode();if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {- tinymce.activeEditor.selection.getNode().style.width = "75%";+ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_one")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_one")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_three")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_three")+ }+ tinymce.activeEditor.dom.addClass(node,"img_size_two")+ });+ tinymce.activeEditor.nodeChanged()}+ })()+`,- imageResize100: `+ imageResize100: `(function() {+ let node = tinymce.activeEditor.selection.getNode();if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {- tinymce.activeEditor.selection.getNode().style.width = "100%";+ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_three")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_three")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_size_two")) {+ tinymce.activeEditor.dom.removeClass(node,"img_size_two")+ }+ tinymce.activeEditor.dom.addClass(node,"img_size_one")+ });+ tinymce.activeEditor.nodeChanged()}+ })()+`,imagepreview: `(function() {if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {@@ -182,6 +221,65 @@ export const execCommands = {}})();`,+ imagefloatleft:`(function () {+let node = tinymce.activeEditor.selection.getNode();+ if (node.tagName === 'IMG') {++ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_right")) {+ tinymce.activeEditor.dom.removeClass(node,"img_float_right")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_none")) {+ tinymce.activeEditor.dom.removeClass(node,"img_float_none")+ }+ tinymce.activeEditor.dom.addClass(node,"img_float_left")+ });+ tinymce.activeEditor.nodeChanged()++ }+ })();++ `,+ imagefloatright:`(function () {+let node = tinymce.activeEditor.selection.getNode();+ if (node.tagName === 'IMG') {++ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_left")) {+ tinymce.activeEditor.dom.removeClass(node, "img_float_left")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_none")) {+ tinymce.activeEditor.dom.removeClass(node,"img_float_none")+ }+ tinymce.activeEditor.dom.addClass(node,"img_float_right")+ });+ tinymce.activeEditor.nodeChanged()++ }+ })()++ `+ ,+ imagefloatnone:`(function () {+let node = tinymce.activeEditor.selection.getNode();+ if (node.tagName === 'IMG') {++ tinymce.activeEditor.undoManager.transact(function() {+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_left")) {+ tinymce.activeEditor.dom.removeClass(node,"img_float_left")+ }+ if (tinymce.activeEditor.dom.hasClass(node,"img_float_right")) {+ tinymce.activeEditor.dom.removeClass(node,"img_float_right")+ }+ tinymce.activeEditor.dom.addClass(node,"img_float_none")+ });+ tinymce.activeEditor.nodeChanged()++ }+ })()++ `+};const handleImageResponse = response => {diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js b/apps/mobile/src/views/Editor/tiny/toolbar/constants.jsindex f6d9bb2f8..544842615 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/constants.js@@ -178,5 +178,8 @@ export const TOOLBAR_ICONS = {tablecolumnprops:"table-column",tableconfig:"table-cog",imagepreview:"fullscreen",- removeimage:"delete"+ removeimage:"delete",+ imagefloatleft:"format-float-left",+ imagefloatright:"format-float-right",+ imagefloatnone:"format-float-none",};