Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

remove trialing commans in html bundle

ammarahm-ed9540721d205d
diff --git a/apps/mobile/android/app/src/main/assets/constants.js b/apps/mobile/android/app/src/main/assets/constants.js
index d425e5261..b9b5ca54a 100755
--- a/apps/mobile/android/app/src/main/assets/constants.js
+++ b/apps/mobile/android/app/src/main/assets/constants.js
@@ -275,13 +275,13 @@ var minifyImg = function (
resolve,
imageArguments = 0.7
) {
- fetch(dataUrl).then(function(res) {
- res.blob().then(function(blob) {
+ fetch(dataUrl).then(function (res) {
+ res.blob().then(function (blob) {
new Compressor(blob, {
quality: imageArguments,
width: newWidth,
mimeType: imageType,
- success: function(result) {
+ success: function (result) {
let fileReader = new FileReader();
fileReader.onloadend = function () {
resolve(fileReader.result);
@@ -289,27 +289,27 @@ var minifyImg = function (
};
fileReader.readAsDataURL(result);
},
- error: function(err) {
+ error: function (err) {
console.log(err.message);
}
});
- })
+ });
});
};
function loadImage() {
let fileInput = document.querySelector('#image-input');
- let listener = function() {
+ let listener = function () {
if (fileInput.files != null && fileInput.files[0] != null) {
let reader = new FileReader();
console.log(reader.readyState, 'READY STATE');
- let load = function(e) {
+ let load = function (e) {
console.log(e, 'loaded error');
minifyImg(
reader.result,
1024,
'image/jpeg',
- function(r) {
+ function (r) {
var content = `<img style="max-width:100% !important;" src="${r}">`;
editor.insertContent(content);
},
@@ -318,14 +318,14 @@ function loadImage() {
fileInput.removeEventListener('change', listener);
reader.removeEventListener('load', load);
};
- let error = function() {
+ let error = function () {
console.log('error');
reader.onload = null;
fileInput.removeEventListener('change', listener);
reader.removeEventListener('load', load);
reader.removeEventListener('error', error);
};
- reader.onabort = function() {
+ reader.onabort = function () {
console.log('abort');
};
reader.addEventListener('load', load);
diff --git a/apps/mobile/android/app/src/main/assets/init.js b/apps/mobile/android/app/src/main/assets/init.js
index 4b2410113..47ad02493 100755
--- a/apps/mobile/android/app/src/main/assets/init.js
+++ b/apps/mobile/android/app/src/main/assets/init.js
@@ -5,7 +5,7 @@ function reactNativeEventHandler(type, value) {
window.ReactNativeWebView.postMessage(
JSON.stringify({
type: type,
- value: value,
+ value: value
})
);
}
@@ -13,21 +13,21 @@ function reactNativeEventHandler(type, value) {
let DEFAULT_FONT_SIZE = '12pt';
let EDITOR_SETTINGS = {
- fontSize:12,
- directionality:'ltr'
-}
+ fontSize: 12,
+ directionality: 'ltr'
+};
function loadSettings() {
let settings = localStorage.getItem('editorSettings');
if (settings) {
settings = JSON.parse(settings);
EDITOR_SETTINGS = settings;
- }
+ }
}
function changeDirection(rtl) {
loadSettings();
- EDITOR_SETTINGS.directionality = rtl? 'rtl' : "ltr";
+ EDITOR_SETTINGS.directionality = rtl ? 'rtl' : 'ltr';
localStorage.setItem('editorSettings', JSON.stringify(EDITOR_SETTINGS));
if (rtl) {
tinymce.activeEditor.execCommand('mceDirectionRTL');
@@ -114,13 +114,13 @@ function init_tiny(size) {
selector: '#tiny_textarea',
menubar: false,
min_height: size,
- directionality:EDITOR_SETTINGS.directionality,
+ directionality: EDITOR_SETTINGS.directionality,
skin_url: 'dist/skins/notesnook',
content_css: 'dist/skins/notesnook',
plugins: [
'mychecklist advlist autolink textpattern hr lists link noneditable image',
'searchreplace mycode',
- 'media imagetools table paste wordcount autoresize directionality',
+ 'media imagetools table paste wordcount autoresize directionality'
],
toolbar: false,
paste_data_images: true,
@@ -231,7 +231,7 @@ function init_tiny(size) {
resize: true,
mobile: {
resize: false,
- object_resizing: false,
+ object_resizing: false
},
image_description: false,
image_caption: false,
@@ -254,7 +254,7 @@ function init_tiny(size) {
editor.undoManager.transact(function () {
tinymce.activeEditor.execCommand('Delete');
});
- },
+ }
});
editor.ui.registry.addButton('imageopts', {
icon: 'image-options',
@@ -264,7 +264,7 @@ function init_tiny(size) {
},
onclick: function () {
reactNativeEventHandler('imageoptions');
- },
+ }
});
editor.ui.registry.addButton('imagepreview', {
@@ -293,7 +293,7 @@ function init_tiny(size) {
xhr.send();
}
},
- onclick: function () {},
+ onclick: function () {}
});
},
init_instance_callback: function (edit) {
@@ -363,13 +363,13 @@ function init_tiny(size) {
e.preventDefault();
e.elm.scrollIntoView({
behavior: 'smooth',
- block: 'nearest',
+ block: 'nearest'
});
});
editor.on('input', onChange);
editor.on('keyup', onChange);
editor.on('NodeChange', onChange);
- },
+ }
});
}
window.prevContent = '';
@@ -432,7 +432,7 @@ function selectchange() {
currentFormats.current = {
index: range.startOffset,
- length: range.endOffset - range.startOffset,
+ length: range.endOffset - range.startOffset
};
currentFormats.fontsize = editor.selection.getNode().style.fontSize;
diff --git a/apps/mobile/android/app/src/main/assets/listeners.js b/apps/mobile/android/app/src/main/assets/listeners.js
index 249f4d07e..3c6d3a159 100755
--- a/apps/mobile/android/app/src/main/assets/listeners.js
+++ b/apps/mobile/android/app/src/main/assets/listeners.js
@@ -6,14 +6,14 @@ function attachTitleInputListeners() {
infoBar = '.info-bar';
document.addEventListener(
'DOMContentLoaded',
- function() {
+ function () {
autosize();
- document.body.onscroll = function(event) {
+ document.body.onscroll = function (event) {
if (scrollTimer) {
clearTimeout(scrollTimer);
scrollTimer = null;
}
- scrollTimer = setTimeout(function() {
+ scrollTimer = setTimeout(function () {
window.ReactNativeWebView.postMessage(
JSON.stringify({
visible: event.target.documentElement.scrollTop,
@@ -115,7 +115,7 @@ function attachMessageListener() {
if (isSafari) {
listenerHandler = window;
}
- listenerHandler.addEventListener('message', function(data) {
+ listenerHandler.addEventListener('message', function (data) {
let message = JSON.parse(data.data);
let type = message.type;
let value = message.value;
@@ -125,7 +125,7 @@ function attachMessageListener() {
isLoading = true;
tinymce.activeEditor.mode.set('readonly');
tinymce.activeEditor.setContent(value);
- setTimeout(function() {
+ setTimeout(function () {
document.activeElement.blur();
window.blur();
tinymce.activeEditor.mode.set('design');
@@ -139,12 +139,12 @@ function attachMessageListener() {
document.getElementsByClassName('htmldiff_div')[0].innerHTML = value;
break;
case 'theme':
- pageTheme.colors = JSON.parse(value);
- setTheme();
- break;
+ pageTheme.colors = JSON.parse(value);
+ setTheme();
+ break;
case 'title':
document.getElementById('titleInput').value = value;
- setTimeout(function() {
+ setTimeout(function () {
autosize();
}, 100);
break;
diff --git a/apps/mobile/html/Plain.bundle/site/constants.js b/apps/mobile/html/Plain.bundle/site/constants.js
index ded77646c..076ef6a81 100755
--- a/apps/mobile/html/Plain.bundle/site/constants.js
+++ b/apps/mobile/html/Plain.bundle/site/constants.js
@@ -275,13 +275,13 @@ var minifyImg = function (
resolve,
imageArguments = 0.7
) {
- fetch(dataUrl).then(function(res) {
- res.blob().then(function(blob) {
+ fetch(dataUrl).then(function (res) {
+ res.blob().then(function (blob) {
new Compressor(blob, {
quality: imageArguments,
width: newWidth,
mimeType: imageType,
- success: function(result) {
+ success: function (result) {
let fileReader = new FileReader();
fileReader.onloadend = function () {
resolve(fileReader.result);
@@ -289,27 +289,27 @@ var minifyImg = function (
};
fileReader.readAsDataURL(result);
},
- error: function(err) {
+ error: function (err) {
console.log(err.message);
}
});
- })
+ });
});
};
function loadImage() {
let fileInput = document.querySelector('#image-input');
- let listener = function() {
+ let listener = function () {
if (fileInput.files != null && fileInput.files[0] != null) {
let reader = new FileReader();
console.log(reader.readyState, 'READY STATE');
- let load = function(e) {
+ let load = function (e) {
console.log(e, 'loaded error');
minifyImg(
reader.result,
1024,
'image/jpeg',
- function(r) {
+ function (r) {
var content = `<img style="max-width:100% !important;" src="${r}">`;
editor.insertContent(content);
},
@@ -318,14 +318,14 @@ function loadImage() {
fileInput.removeEventListener('change', listener);
reader.removeEventListener('load', load);
};
- let error = function() {
+ let error = function () {
console.log('error');
reader.onload = null;
fileInput.removeEventListener('change', listener);
reader.removeEventListener('load', load);
reader.removeEventListener('error', error);
};
- reader.onabort = function() {
+ reader.onabort = function () {
console.log('abort');
};
reader.addEventListener('load', load);
diff --git a/apps/mobile/html/Plain.bundle/site/init.js b/apps/mobile/html/Plain.bundle/site/init.js
index 1295f5ec4..e8670d95e 100755
--- a/apps/mobile/html/Plain.bundle/site/init.js
+++ b/apps/mobile/html/Plain.bundle/site/init.js
@@ -1,4 +1,3 @@
-
attachTitleInputListeners();
autosize();
function reactNativeEventHandler(type, value) {
@@ -24,7 +23,7 @@ function init_tiny(size) {
plugins: [
'mychecklist advlist autolink textpattern hr lists link noneditable image',
'searchreplace mycode',
- 'media imagetools table paste wordcount autoresize directionality',
+ 'media imagetools table paste wordcount autoresize directionality'
],
toolbar: false,
paste_data_images: true,
@@ -92,14 +91,13 @@ function init_tiny(size) {
autoresize_bottom_margin: 120,
table_toolbar:
'tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol',
- imagetools_toolbar:
- 'rotateleft rotateright flipv fliph | imageopts ',
+ imagetools_toolbar: 'rotateleft rotateright flipv fliph | imageopts ',
placeholder: 'Start writing your note here',
object_resizing: true,
resize: true,
mobile: {
resize: false,
- object_resizing: false,
+ object_resizing: false
},
image_description: false,
image_caption: false,
@@ -114,21 +112,24 @@ function init_tiny(size) {
icon: 'remove',
tooltip: 'Remove image',
onAction: function () {
- editor.undoManager.transact(function() {tinymce.activeEditor.execCommand('Delete');});
+ editor.undoManager.transact(function () {
+ tinymce.activeEditor.execCommand('Delete');
+ });
},
onclick: function () {
- editor.undoManager.transact(function() {tinymce.activeEditor.execCommand('Delete');});
-
+ editor.undoManager.transact(function () {
+ tinymce.activeEditor.execCommand('Delete');
+ });
}
});
editor.ui.registry.addButton('imageopts', {
icon: 'image-options',
tooltip: 'Image properties',
onAction: function () {
- reactNativeEventHandler("imageoptions");
+ reactNativeEventHandler('imageoptions');
},
onclick: function () {
- reactNativeEventHandler("imageoptions");
+ reactNativeEventHandler('imageoptions');
}
});
@@ -189,7 +190,6 @@ function init_tiny(size) {
});
editor.on('ScrollIntoView', function (e) {
-
e.preventDefault();
e.elm.scrollIntoView({
behavior: 'smooth',
@@ -204,21 +204,21 @@ function init_tiny(size) {
}
window.prevContent = '';
const onChange = function (event) {
- if (event.type === 'nodechange' && !event.selectionChange) return;
- if (isLoading) {
- isLoading = false;
- return;
- }
- if (editor.plugins.wordcount.getCount() === 0) return;
- clearTimeout(changeTimer);
- changeTimer = null;
- changeTimer = setTimeout(function () {
- selectchange();
- reactNativeEventHandler('tiny', editor.getContent());
- reactNativeEventHandler('history', {
- undo: editor.undoManager.hasUndo(),
- redo: editor.undoManager.hasRedo()
- });
+ if (event.type === 'nodechange' && !event.selectionChange) return;
+ if (isLoading) {
+ isLoading = false;
+ return;
+ }
+ if (editor.plugins.wordcount.getCount() === 0) return;
+ clearTimeout(changeTimer);
+ changeTimer = null;
+ 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/Plain.bundle/site/listeners.js b/apps/mobile/html/Plain.bundle/site/listeners.js
index 249f4d07e..3c6d3a159 100755
--- a/apps/mobile/html/Plain.bundle/site/listeners.js
+++ b/apps/mobile/html/Plain.bundle/site/listeners.js
@@ -6,14 +6,14 @@ function attachTitleInputListeners() {
infoBar = '.info-bar';
document.addEventListener(
'DOMContentLoaded',
- function() {
+ function () {
autosize();
- document.body.onscroll = function(event) {
+ document.body.onscroll = function (event) {
if (scrollTimer) {
clearTimeout(scrollTimer);
scrollTimer = null;
}
- scrollTimer = setTimeout(function() {
+ scrollTimer = setTimeout(function () {
window.ReactNativeWebView.postMessage(
JSON.stringify({
visible: event.target.documentElement.scrollTop,
@@ -115,7 +115,7 @@ function attachMessageListener() {
if (isSafari) {
listenerHandler = window;
}
- listenerHandler.addEventListener('message', function(data) {
+ listenerHandler.addEventListener('message', function (data) {
let message = JSON.parse(data.data);
let type = message.type;
let value = message.value;
@@ -125,7 +125,7 @@ function attachMessageListener() {
isLoading = true;
tinymce.activeEditor.mode.set('readonly');
tinymce.activeEditor.setContent(value);
- setTimeout(function() {
+ setTimeout(function () {
document.activeElement.blur();
window.blur();
tinymce.activeEditor.mode.set('design');
@@ -139,12 +139,12 @@ function attachMessageListener() {
document.getElementsByClassName('htmldiff_div')[0].innerHTML = value;
break;
case 'theme':
- pageTheme.colors = JSON.parse(value);
- setTheme();
- break;
+ pageTheme.colors = JSON.parse(value);
+ setTheme();
+ break;
case 'title':
document.getElementById('titleInput').value = value;
- setTimeout(function() {
+ setTimeout(function () {
autosize();
}, 100);
break;