chore(release): components

This commit is contained in:
StandardNotes CI
2022-06-14 21:41:35 +00:00
parent 8c8c2dc009
commit 4e16fd190b
104 changed files with 349 additions and 7654 deletions

View File

@@ -1,87 +1,78 @@
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
document.addEventListener('DOMContentLoaded', function (event) {
const editor = document.getElementById('editor-source')
let workingNote
const componentRelay = new ComponentRelay({
var editor = document.getElementById('editor-source');
var workingNote;
var componentRelay = new ComponentRelay({
targetWindow: window,
onReady: () => {
const platform = componentRelay.platform
onReady: function onReady() {
var platform = componentRelay.platform;
if (platform) {
document.body.classList.add(platform)
document.body.classList.add(platform);
}
},
})
}
});
componentRelay.streamContextItem(function (note) {
workingNote = note;
componentRelay.streamContextItem((note) => {
workingNote = note
// Only update UI on non-metadata updates.
if (note.isMetadataUpdate) {
return
return;
}
editor.value = note.content.text
window.upmath.updateText()
editor.setAttribute('spellcheck', JSON.stringify(workingNote.content.spellcheck))
})
editor.value = note.content.text;
window.upmath.updateText();
editor.setAttribute('spellcheck', JSON.stringify(workingNote.content.spellcheck));
});
editor.addEventListener('input', function (event) {
const text = editor.value || ''
var text = editor.value || '';
function strip(html) {
const tmp = document.implementation.createHTMLDocument('New').body
tmp.innerHTML = html
return tmp.textContent || tmp.innerText || ''
var tmp = document.implementation.createHTMLDocument('New').body;
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
}
function truncateString(string, limit = 90) {
function truncateString(string) {
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 90;
if (string.length <= limit) {
return string
return string;
} else {
return string.substring(0, limit) + '...'
return string.substring(0, limit) + '...';
}
}
if (workingNote) {
// Be sure to capture this object as a variable, as workingNote may be reassigned in `streamContextItem`, so by the time
// you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to
// the right object, and it will save incorrectly.
const note = workingNote
componentRelay.saveItemWithPresave(note, () => {
window.upmath.updateText()
const html = window.upmath.getHTML()
const strippedHtml = truncateString(strip(html))
note.content.preview_plain = strippedHtml
note.content.preview_html = null
note.content.text = text
})
var note = workingNote;
componentRelay.saveItemWithPresave(note, function () {
window.upmath.updateText();
var html = window.upmath.getHTML();
var strippedHtml = truncateString(strip(html));
note.content.preview_plain = strippedHtml;
note.content.preview_html = null;
note.content.text = text;
});
}
})
});
// Tab handler
editor.addEventListener('keydown', function (event) {
if (!event.shiftKey && event.which == 9) {
event.preventDefault()
event.preventDefault();
// Using document.execCommand gives us undo support
if (!document.execCommand('insertText', false, '\t')) {
// document.execCommand works great on Chrome/Safari but not Firefox
const start = this.selectionStart
const end = this.selectionEnd
const spaces = ' '
var start = this.selectionStart;
var end = this.selectionEnd;
var spaces = ' ';
// Insert 4 spaces
this.value = this.value.substring(0, start) + spaces + this.value.substring(end)
this.value = this.value.substring(0, start) + spaces + this.value.substring(end);
// Place cursor 4 spaces away from where
// the tab key was pressed
this.selectionStart = this.selectionEnd = start + 4
this.selectionStart = this.selectionEnd = start + 4;
}
}
})
})
});
});
},{}]},{},[1]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long