Files
standardnotes-app-web/public/components/org.standardnotes.plus-editor/dist/dist.js
Mo 063c3b2fee feat: per-note spellcheck (#815)
* feat: per-note spellcheck control

* fix: remove fill from svg

* feat: move spellcheck pref into defaults preferences section

* fix: use faded css class instead of opacity

* feat: plus editor 1.6.0
2022-01-14 14:32:16 -06:00

2 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
document.addEventListener("DOMContentLoaded",(function(){let e,t,n,o,i,a=!1,r=!0,s=!1;const l=["address","article","aside","blockquote","details","dialog","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","ol","p","pre","section","table","ul"].join(", ");function c(){if(t){const i=t;e.saveItemWithPresave(i,(()=>{o=$("#summernote").summernote("code"),i.clientData=n,i.content.text=o,i.content.preview_plain=function(e,t=90){return e.length<=t?e:e.substring(0,t)+"..."}(function(e){const t=document.implementation.createHTMLDocument("New").body;return t.innerHTML=e,t.textContent||t.innerText||""}(o)),i.content.preview_html=null}))}}function u(){return e.getComponentDataValueForKey("notes")||{}}$("#summernote").summernote({height:500,minHeight:null,maxHeight:null,focus:!0,tabDisable:!0,showDomainOnlyForAutolink:!1,toolbar:[["para",["style"]],["style",["bold","italic","underline","strikethrough","clear"]],["fontsize",["fontsize","fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["height",["height"]],["insert",["table","link","hr","picture","video"]],["misc",["codeview","help"]]],fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Monospace","Roboto","system-ui","Tahoma","Times New Roman","Verdana"],callbacks:{onInit:function(){},onImageUpload:function(){alert("Until we can encrypt image files, uploads are not currently supported. We recommend using the Image button in the toolbar and copying an image URL instead.")}}}),$("#summernote").on("summernote.change",(function(){document.querySelectorAll(l).forEach((e=>e.setAttribute("dir","auto"))),a||c()})),$("textarea.note-codable").on("input",(()=>{c()})),e=new ComponentRelay({initialPermissions:[{name:"stream-context-item"}],targetWindow:window,onReady:()=>{const t=e.platform;t&&document.body.classList.add(t)}}),e.streamContextItem((l=>{!function(l){if(l.uuid!==i&&(o=null,r=!0,i=l.uuid),t=l,l.isMetadataUpdate)return;n=l.clientData;let c=l.content.text;if($(".note-editable").attr("spellcheck",JSON.stringify(l.content.spellcheck)),c==o)return;const m=$("#summernote");if(m){a=!0;const t=/<[a-z][\s\S]*>/i.test(c);s||(m.summernote("fullscreen.toggle"),s=!0),r&&!t&&(c=((c||"")+"").replace(/\t/g," ").replace(/\r\n|\r|\n/g,"<br />"));let n=!1;if(function(e){const t=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html");return Array.from(t.body.childNodes).some((e=>"SCRIPT"==e.nodeName))}(c)){const t=u()[i];t?n=t.trustUnsafeContent||!1:new Promise((e=>{new Stylekit.SKAlert({title:null,text:"Weve detected that this note contains a script or code snippet which may be unsafe to execute. Scripts executed in the editor have the ability to impersonate as the editor to Standard Notes. Press Continue to mark this script as safe and proceed, or Cancel to avoid rendering this note.",buttons:[{text:"Cancel",style:"neutral",action:function(){e(!1)}},{text:"Continue",style:"danger",action:function(){e(!0)}}]}).present()})).then((t=>{t&&(function(t,n){const o=u();o[i]={trustUnsafeContent:n},e.setComponentDataValueForKey("notes",o)}(0,t),n=t)}))}else n=!0;if(!n)return m.summernote("code",""),void m.summernote("disable");m.summernote("enable"),m.summernote("code",c),r&&(m.summernote("commit"),r=!1),a=!1}}(l)}))}));
//# sourceMappingURL=dist.js.map