panda-editor 0.6.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/app/javascript/panda/editor/application.js +8 -6
  4. data/app/javascript/panda/editor/controllers/index.js +5 -0
  5. data/app/javascript/panda/editor/editor_js_config.js +7 -5
  6. data/app/javascript/panda/editor/editor_js_initializer.js +10 -3
  7. data/app/javascript/panda/editor/plugins/embed.min.js +2 -0
  8. data/app/javascript/panda/editor/plugins/header.min.js +9 -0
  9. data/app/javascript/panda/editor/plugins/nested-list.min.js +2 -0
  10. data/app/javascript/panda/editor/plugins/paragraph.min.js +9 -0
  11. data/app/javascript/panda/editor/plugins/quote.min.js +2 -0
  12. data/app/javascript/panda/editor/plugins/simple-image.min.js +2 -0
  13. data/app/javascript/panda/editor/plugins/table.min.js +2 -0
  14. data/app/javascript/panda/editor/rich_text_editor.js +2 -3
  15. data/app/services/panda/editor/html_to_editor_js_converter.rb +68 -68
  16. data/app/stylesheets/editor.css +120 -0
  17. data/config/importmap.rb +22 -11
  18. data/docs/FOOTNOTES.md +96 -3
  19. data/lefthook.yml +16 -0
  20. data/lib/panda/editor/asset_loader.rb +27 -27
  21. data/lib/panda/editor/blocks/alert.rb +10 -10
  22. data/lib/panda/editor/blocks/base.rb +1 -1
  23. data/lib/panda/editor/blocks/header.rb +2 -2
  24. data/lib/panda/editor/blocks/image.rb +11 -11
  25. data/lib/panda/editor/blocks/list.rb +25 -6
  26. data/lib/panda/editor/blocks/paragraph.rb +41 -10
  27. data/lib/panda/editor/blocks/quote.rb +6 -6
  28. data/lib/panda/editor/blocks/table.rb +6 -6
  29. data/lib/panda/editor/content.rb +11 -8
  30. data/lib/panda/editor/engine.rb +29 -9
  31. data/lib/panda/editor/footnote_registry.rb +10 -5
  32. data/lib/panda/editor/html_to_editor_js_converter.rb +1 -1
  33. data/lib/panda/editor/renderer.rb +31 -31
  34. data/lib/panda/editor/version.rb +1 -1
  35. data/lib/panda/editor.rb +18 -16
  36. data/lib/tasks/assets.rake +27 -27
  37. data/mise.toml +2 -0
  38. data/panda-editor.gemspec +25 -24
  39. metadata +32 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adac7a7394c996ae17e8c3312f0b20bc8517724aa82397694ecce20e82821280
4
- data.tar.gz: 595a17b99fde3d04816f1b957ce9c875de521475d69bc9358f3c370e9c380301
3
+ metadata.gz: 1b5dd5e6612814d60e6112793b8de4673c48d465cbd43c327b2ca5d1b69af42f
4
+ data.tar.gz: 5b68f6606d59c3dbcd68395cb40efcd0cb68d1d54f1c52a9b50a9b4ff235e5d5
5
5
  SHA512:
6
- metadata.gz: 9395e397b2c94eea2d8d8c0a0183a6262a1bfe79dbc9aae23f833a255b214be22ffc6ca4f92f2e2218adadf948410e388c853bea3b3eaf589ed555ba9c1c2df4
7
- data.tar.gz: 6fc84783464e4761bcf1fec9f162ff7fec33b571bf816d026167514c1d63cc4f640ffc8c0863e765bf58730f0713a7a47ff5f62b99c810a5f1806804b62e7f8c
6
+ metadata.gz: 7d289881c3a87f4ed4094e795a5abc2b62f191b8474ee8d22dacbd89e02ba0bfa799ff76d562d971e7e08e01ef20c3b27a9c99d32cc19868b68e83623f44d0d4
7
+ data.tar.gz: eecf90ed4f1a54db8321c35372ebb57e9ac00b1b86952fb2f9ab6567fcdeeb5cee514111fdee5912f093a09930b525df7bf3b1a85b1c856fe4e8268d42222d66
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 4.0.0
@@ -1,16 +1,18 @@
1
1
  // Panda Editor Application JavaScript
2
2
  // This file serves as the entry point for all EditorJS functionality
3
3
 
4
- import { EditorJSInitializer } from "./editor_js_initializer"
5
- import { EditorJSConfig } from "./editor_js_config"
6
- import { RichTextEditor } from "./rich_text_editor"
7
- import FootnoteTool from "./tools/footnote_tool"
8
- import ParagraphWithFootnotes from "./tools/paragraph_with_footnotes"
4
+ import { EditorJSInitializer } from "./editor_js_initializer.js"
5
+ import { EDITOR_JS_RESOURCES, EDITOR_JS_CSS, getEditorConfig } from "./editor_js_config.js"
6
+ import RichTextEditor from "./rich_text_editor.js"
7
+ import FootnoteTool from "./tools/footnote_tool.js"
8
+ import ParagraphWithFootnotes from "./tools/paragraph_with_footnotes.js"
9
9
 
10
10
  // Export for global access
11
11
  window.PandaEditor = {
12
12
  EditorJSInitializer,
13
- EditorJSConfig,
13
+ EDITOR_JS_RESOURCES,
14
+ EDITOR_JS_CSS,
15
+ getEditorConfig,
14
16
  RichTextEditor,
15
17
  FootnoteTool,
16
18
  ParagraphWithFootnotes,
@@ -0,0 +1,5 @@
1
+ // Panda Editor has no Stimulus controllers of its own
2
+ // This file exists for compatibility with panda_core_javascript helper
3
+ // which expects all modules to export a controllers/index entry point
4
+
5
+ console.debug("[Panda Editor] No controllers to load");
@@ -319,14 +319,16 @@ export const getEditorConfig = (elementId, previousData, doc = document) => {
319
319
  })
320
320
  )
321
321
 
322
- // Allow applications to customize the config through Ruby
323
- if (window.PANDA_CMS_EDITOR_JS_CONFIG) {
324
- Object.assign(config.tools, window.PANDA_CMS_EDITOR_JS_CONFIG)
322
+ // Allow applications to customize the config through the iframe's window
323
+ // (e.g., neurobetter sets window.PANDA_CMS_EDITOR_JS_CONFIG in its application.js)
324
+ if (win.PANDA_CMS_EDITOR_JS_CONFIG) {
325
+ console.debug("[Panda CMS] Found custom EditorJS config:", Object.keys(win.PANDA_CMS_EDITOR_JS_CONFIG))
326
+ Object.assign(config.tools, win.PANDA_CMS_EDITOR_JS_CONFIG)
325
327
  }
326
328
 
327
329
  // Allow applications to customize the config through JavaScript
328
- if (typeof window.customizeEditorJS === 'function') {
329
- window.customizeEditorJS(config)
330
+ if (typeof win.customizeEditorJS === 'function') {
331
+ win.customizeEditorJS(config)
330
332
  }
331
333
 
332
334
  return config
@@ -1,6 +1,6 @@
1
- import { ResourceLoader } from "panda/cms/editor/resource_loader"
2
- import { EDITOR_JS_RESOURCES, EDITOR_JS_CSS, getEditorConfig } from "panda/cms/editor/editor_js_config"
3
- import { CSSExtractor } from "panda/cms/editor/css_extractor"
1
+ import { ResourceLoader } from "./resource_loader.js"
2
+ import { EDITOR_JS_RESOURCES, EDITOR_JS_CSS, getEditorConfig } from "./editor_js_config.js"
3
+ import { CSSExtractor } from "./css_extractor.js"
4
4
 
5
5
  export class EditorJSInitializer {
6
6
  constructor(document, withinIFrame = false) {
@@ -269,6 +269,13 @@ export class EditorJSInitializer {
269
269
  }
270
270
  }
271
271
 
272
+ // Allow applications to customize the config through the iframe's window
273
+ // (e.g., neurobetter sets window.PANDA_CMS_EDITOR_JS_CONFIG in its application.js)
274
+ if (win.PANDA_CMS_EDITOR_JS_CONFIG) {
275
+ console.debug("[Panda CMS] Found custom EditorJS config:", Object.keys(win.PANDA_CMS_EDITOR_JS_CONFIG))
276
+ Object.assign(config.tools, win.PANDA_CMS_EDITOR_JS_CONFIG)
277
+ }
278
+
272
279
  // Remove any undefined tools from the config
273
280
  config.tools = Object.fromEntries(
274
281
  Object.entries(config.tools)
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.embed-tool--loading .embed-tool__caption{display:none}.embed-tool--loading .embed-tool__preloader{display:block}.embed-tool--loading .embed-tool__content{display:none}.embed-tool__preloader{display:none;position:relative;height:200px;box-sizing:border-box;border-radius:5px;border:1px solid #e6e9eb}.embed-tool__preloader:before{content:"";position:absolute;z-index:3;left:50%;top:50%;width:30px;height:30px;margin-top:-25px;margin-left:-15px;border-radius:50%;border:2px solid #cdd1e0;border-top-color:#388ae5;box-sizing:border-box;animation:embed-preloader-spin 2s infinite linear}.embed-tool__url{position:absolute;bottom:20px;left:50%;transform:translate(-50%);max-width:250px;color:#7b7e89;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.embed-tool__content{width:100%}.embed-tool__caption{margin-top:7px}.embed-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.embed-tool__caption[contentEditable=true][data-placeholder]:empty:before{opacity:1}.embed-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}@keyframes embed-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
+ (function(c,u){typeof exports=="object"&&typeof module<"u"?module.exports=u():typeof define=="function"&&define.amd?define(u):(c=typeof globalThis<"u"?globalThis:c||self,c.Embed=u())})(this,function(){"use strict";const c={vimeo:{regex:/(?:http[s]?:\/\/)?(?:www.)?(?:player.)?vimeo\.co(?:.+\/([^\/]\d+)(?:#t=[\d]+)?s?$)/,embedUrl:"https://player.vimeo.com/video/<%= remote_id %>?title=0&byline=0",html:'<iframe style="width:100%;" height="320" frameborder="0"></iframe>',height:320,width:580},youtube:{regex:/(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,embedUrl:"https://www.youtube.com/embed/<%= remote_id %>",html:'<iframe style="width:100%;" height="320" frameborder="0" allowfullscreen></iframe>',height:320,width:580,id:([o,t])=>{if(!t&&o)return o;const i={start:"start",end:"end",t:"start",time_continue:"start",list:"list"};return t=t.slice(1).split("&").map(e=>{const[s,n]=e.split("=");return!o&&s==="v"?(o=n,null):!i[s]||n==="LL"||n.startsWith("RDMM")||n.startsWith("FL")?null:`${i[s]}=${n}`}).filter(e=>!!e),o+"?"+t.join("&")}},coub:{regex:/https?:\/\/coub\.com\/view\/([^\/\?\&]+)/,embedUrl:"https://coub.com/embed/<%= remote_id %>",html:'<iframe style="width:100%;" height="320" frameborder="0" allowfullscreen></iframe>',height:320,width:580},vine:{regex:/https?:\/\/vine\.co\/v\/([^\/\?\&]+)/,embedUrl:"https://vine.co/v/<%= remote_id %>/embed/simple/",html:'<iframe style="width:100%;" height="320" frameborder="0" allowfullscreen></iframe>',height:320,width:580},imgur:{regex:/https?:\/\/(?:i\.)?imgur\.com.*\/([a-zA-Z0-9]+)(?:\.gifv)?/,embedUrl:"http://imgur.com/<%= remote_id %>/embed",html:'<iframe allowfullscreen="true" scrolling="no" id="imgur-embed-iframe-pub-<%= remote_id %>" class="imgur-embed-iframe-pub" style="height: 500px; width: 100%; border: 1px solid #000"></iframe>',height:500,width:540},gfycat:{regex:/https?:\/\/gfycat\.com(?:\/detail)?\/([a-zA-Z]+)/,embedUrl:"https://gfycat.com/ifr/<%= remote_id %>",html:`<iframe frameborder='0' scrolling='no' style="width:100%;" height='436' allowfullscreen ></iframe>`,height:436,width:580},"twitch-channel":{regex:/https?:\/\/www\.twitch\.tv\/([^\/\?\&]*)\/?$/,embedUrl:"https://player.twitch.tv/?channel=<%= remote_id %>",html:'<iframe frameborder="0" allowfullscreen="true" scrolling="no" height="366" style="width:100%;"></iframe>',height:366,width:600},"twitch-video":{regex:/https?:\/\/www\.twitch\.tv\/(?:[^\/\?\&]*\/v|videos)\/([0-9]*)/,embedUrl:"https://player.twitch.tv/?video=v<%= remote_id %>",html:'<iframe frameborder="0" allowfullscreen="true" scrolling="no" height="366" style="width:100%;"></iframe>',height:366,width:600},"yandex-music-album":{regex:/https?:\/\/music\.yandex\.ru\/album\/([0-9]*)\/?$/,embedUrl:"https://music.yandex.ru/iframe/#album/<%= remote_id %>/",html:'<iframe frameborder="0" style="border:none;width:540px;height:400px;" style="width:100%;" height="400"></iframe>',height:400,width:540},"yandex-music-track":{regex:/https?:\/\/music\.yandex\.ru\/album\/([0-9]*)\/track\/([0-9]*)/,embedUrl:"https://music.yandex.ru/iframe/#track/<%= remote_id %>/",html:'<iframe frameborder="0" style="border:none;width:540px;height:100px;" style="width:100%;" height="100"></iframe>',height:100,width:540,id:o=>o.join("/")},"yandex-music-playlist":{regex:/https?:\/\/music\.yandex\.ru\/users\/([^\/\?\&]*)\/playlists\/([0-9]*)/,embedUrl:"https://music.yandex.ru/iframe/#playlist/<%= remote_id %>/show/cover/description/",html:'<iframe frameborder="0" style="border:none;width:540px;height:400px;" width="540" height="400"></iframe>',height:400,width:540,id:o=>o.join("/")},codepen:{regex:/https?:\/\/codepen\.io\/([^\/\?\&]*)\/pen\/([^\/\?\&]*)/,embedUrl:"https://codepen.io/<%= remote_id %>?height=300&theme-id=0&default-tab=css,result&embed-version=2",html:"<iframe height='300' scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe>",height:300,width:600,id:o=>o.join("/embed/")},instagram:{regex:/https?:\/\/www\.instagram\.com\/p\/([^\/\?\&]+)\/?.*/,embedUrl:"https://www.instagram.com/p/<%= remote_id %>/embed",html:'<iframe width="400" height="505" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',height:505,width:400},twitter:{regex:/^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+?.*)?$/,embedUrl:"https://twitframe.com/show?url=https://twitter.com/<%= remote_id %>",html:'<iframe width="600" height="600" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',height:300,width:600,id:o=>o.join("/status/")},pinterest:{regex:/https?:\/\/([^\/\?\&]*).pinterest.com\/pin\/([^\/\?\&]*)\/?$/,embedUrl:"https://assets.pinterest.com/ext/embed.html?id=<%= remote_id %>",html:"<iframe scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%; min-height: 400px; max-height: 1000px;'></iframe>",id:o=>o[1]},facebook:{regex:/https?:\/\/www.facebook.com\/([^\/\?\&]*)\/(.*)/,embedUrl:"https://www.facebook.com/plugins/post.php?href=https://www.facebook.com/<%= remote_id %>&width=500",html:"<iframe scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%; min-height: 500px; max-height: 1000px;'></iframe>",id:o=>o.join("/")},aparat:{regex:/(?:http[s]?:\/\/)?(?:www.)?aparat\.com\/v\/([^\/\?\&]+)\/?/,embedUrl:"https://www.aparat.com/video/video/embed/videohash/<%= remote_id %>/vt/frame",html:'<iframe width="600" height="300" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',height:300,width:600},miro:{regex:/https:\/\/miro.com\/\S+(\S{12})\/(\S+)?/,embedUrl:"https://miro.com/app/live-embed/<%= remote_id %>",html:'<iframe width="700" height="500" style="margin: 0 auto;" allowFullScreen frameBorder="0" scrolling="no"></iframe>'},github:{regex:/https?:\/\/gist.github.com\/([^\/\?\&]*)\/([^\/\?\&]*)/,embedUrl:'data:text/html;charset=utf-8,<head><base target="_blank" /></head><body><script src="https://gist.github.com/<%= remote_id %>" ><\/script></body>',html:'<iframe width="100%" height="350" frameborder="0" style="margin: 0 auto;"></iframe>',height:300,width:600,id:o=>`${o.join("/")}.js`}},u="";function p(o,t,i){var e,s,n,r,a;t==null&&(t=100);function l(){var h=Date.now()-r;h<t&&h>=0?e=setTimeout(l,t-h):(e=null,i||(a=o.apply(n,s),n=s=null))}var m=function(){n=this,s=arguments,r=Date.now();var h=i&&!e;return e||(e=setTimeout(l,t)),h&&(a=o.apply(n,s),n=s=null),a};return m.clear=function(){e&&(clearTimeout(e),e=null)},m.flush=function(){e&&(a=o.apply(n,s),n=s=null,clearTimeout(e),e=null)},m}p.debounce=p;var g=p;class d{constructor({data:t,api:i,readOnly:e}){this.api=i,this._data={},this.element=null,this.readOnly=e,this.data=t}set data(t){if(!(t instanceof Object))throw Error("Embed Tool data should be object");const{service:i,source:e,embed:s,width:n,height:r,caption:a=""}=t;this._data={service:i||this.data.service,source:e||this.data.source,embed:s||this.data.embed,width:n||this.data.width,height:r||this.data.height,caption:a||this.data.caption||""};const l=this.element;l&&l.parentNode.replaceChild(this.render(),l)}get data(){if(this.element){const t=this.element.querySelector(`.${this.api.styles.input}`);this._data.caption=t?t.innerHTML:""}return this._data}get CSS(){return{baseClass:this.api.styles.block,input:this.api.styles.input,container:"embed-tool",containerLoading:"embed-tool--loading",preloader:"embed-tool__preloader",caption:"embed-tool__caption",url:"embed-tool__url",content:"embed-tool__content"}}render(){if(!this.data.service){const a=document.createElement("div");return this.element=a,a}const{html:t}=d.services[this.data.service],i=document.createElement("div"),e=document.createElement("div"),s=document.createElement("template"),n=this.createPreloader();i.classList.add(this.CSS.baseClass,this.CSS.container,this.CSS.containerLoading),e.classList.add(this.CSS.input,this.CSS.caption),i.appendChild(n),e.contentEditable=!this.readOnly,e.dataset.placeholder=this.api.i18n.t("Enter a caption"),e.innerHTML=this.data.caption||"",s.innerHTML=t,s.content.firstChild.setAttribute("src",this.data.embed),s.content.firstChild.classList.add(this.CSS.content);const r=this.embedIsReady(i);return i.appendChild(s.content.firstChild),i.appendChild(e),r.then(()=>{i.classList.remove(this.CSS.containerLoading)}),this.element=i,i}createPreloader(){const t=document.createElement("preloader"),i=document.createElement("div");return i.textContent=this.data.source,t.classList.add(this.CSS.preloader),i.classList.add(this.CSS.url),t.appendChild(i),t}save(){return this.data}onPaste(t){const{key:i,data:e}=t.detail,{regex:s,embedUrl:n,width:r,height:a,id:l=f=>f.shift()}=d.services[i],m=s.exec(e).slice(1),h=n.replace(/<%= remote_id %>/g,l(m));this.data={service:i,source:e,embed:h,width:r,height:a}}static prepare({config:t={}}){const{services:i={}}=t;let e=Object.entries(c);const s=Object.entries(i).filter(([r,a])=>typeof a=="boolean"&&a===!0).map(([r])=>r),n=Object.entries(i).filter(([r,a])=>typeof a=="object").filter(([r,a])=>d.checkServiceConfig(a)).map(([r,a])=>{const{regex:l,embedUrl:m,html:h,height:f,width:b,id:w}=a;return[r,{regex:l,embedUrl:m,html:h,height:f,width:b,id:w}]});s.length&&(e=e.filter(([r])=>s.includes(r))),e=e.concat(n),d.services=e.reduce((r,[a,l])=>a in r?(r[a]=Object.assign({},r[a],l),r):(r[a]=l,r),{}),d.patterns=e.reduce((r,[a,l])=>(r[a]=l.regex,r),{})}static checkServiceConfig(t){const{regex:i,embedUrl:e,html:s,height:n,width:r,id:a}=t;let l=i&&i instanceof RegExp&&e&&typeof e=="string"&&s&&typeof s=="string";return l=l&&(a!==void 0?a instanceof Function:!0),l=l&&(n!==void 0?Number.isFinite(n):!0),l=l&&(r!==void 0?Number.isFinite(r):!0),l}static get pasteConfig(){return{patterns:d.patterns}}static get isReadOnlySupported(){return!0}embedIsReady(t){let e=null;return new Promise((s,n)=>{e=new MutationObserver(g.debounce(s,450)),e.observe(t,{childList:!0,subtree:!0})}).then(()=>{e.disconnect()})}}return d});
@@ -0,0 +1,9 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}.ce-header[contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;display:none;cursor:text}.ce-header[contentEditable=true][data-placeholder]:empty:before{display:block}.ce-header[contentEditable=true][data-placeholder]:empty:focus:before{display:none}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(n,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(n=typeof globalThis<"u"?globalThis:n||self,n.Header=r())})(this,function(){"use strict";const n="",r='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',o='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',a='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',h='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',d='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',u='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',g='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';/**
3
+ * Header block for the Editor.js.
4
+ *
5
+ * @author CodeX (team@ifmo.su)
6
+ * @copyright CodeX 2018
7
+ * @license MIT
8
+ * @version 2.0.0
9
+ */class c{constructor({data:e,config:t,api:s,readOnly:i}){this.api=s,this.readOnly=i,this._CSS={block:this.api.styles.block,wrapper:"ce-header"},this._settings=t,this._data=this.normalizeData(e),this._element=this.getTag()}normalizeData(e){const t={};return typeof e!="object"&&(e={}),t.text=e.text||"",t.level=parseInt(e.level)||this.defaultLevel.number,t}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){const t={text:this.data.text+e.text,level:this.data.level};this.data=t}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const t=this.getTag();t.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(t,this._element),this._element=t}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(t=>t.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){const e=this.levels.find(t=>t.number===this._settings.defaultLevel);if(e)return e;console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){const e=[{number:1,tag:"H1",svg:r},{number:2,tag:"H2",svg:o},{number:3,tag:"H3",svg:a},{number:4,tag:"H4",svg:h},{number:5,tag:"H5",svg:d},{number:6,tag:"H6",svg:u}];return this._settings.levels?e.filter(t=>this._settings.levels.includes(t.number)):e}onPaste(e){const t=e.detail.data;let s=this.defaultLevel.number;switch(t.tagName){case"H1":s=1;break;case"H2":s=2;break;case"H3":s=3;break;case"H4":s=4;break;case"H5":s=5;break;case"H6":s=6;break}this._settings.levels&&(s=this._settings.levels.reduce((i,l)=>Math.abs(l-s)<Math.abs(i-s)?l:i)),this.data={level:s,text:t.innerHTML}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:g,title:"Heading"}}}return c});
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"•"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(a,u){typeof exports=="object"&&typeof module<"u"?module.exports=u():typeof define=="function"&&define.amd?define(u):(a=typeof globalThis<"u"?globalThis:a||self,a.NestedList=u())})(this,function(){"use strict";function a(h,e=null,t={}){const r=document.createElement(h);Array.isArray(e)?r.classList.add(...e):e&&r.classList.add(e);for(const n in t)r[n]=t[n];return r}function u(h){const e=a("div");return e.appendChild(h),e.innerHTML}function g(h){let e;return h.nodeType!==Node.ELEMENT_NODE?e=h.textContent:(e=h.innerHTML,e=e.replaceAll("<br>","")),e.trim().length===0}class d{constructor(){this.savedFakeCaret=void 0}save(){const e=d.range,t=a("span");t.hidden=!0,e.insertNode(t),this.savedFakeCaret=t}restore(){if(!this.savedFakeCaret)return;const e=window.getSelection(),t=new Range;t.setStartAfter(this.savedFakeCaret),t.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(t),setTimeout(()=>{this.savedFakeCaret.remove()},150)}static get range(){const e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){const e=window.getSelection();if(!e.rangeCount)return;const t=e.getRangeAt(0);let r=t.startContainer;r.nodeType!==Node.ELEMENT_NODE&&(r=r.parentNode);const n=r.closest("[contenteditable]");t.deleteContents();const s=t.cloneRange();return s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset),s.extractContents()}static focus(e,t=!0){const r=document.createRange(),n=window.getSelection();r.selectNodeContents(e),r.collapse(t),n.removeAllRanges(),n.addRange(r)}static isAtStart(){const e=window.getSelection();if(e.focusOffset>0)return!1;const t=e.focusNode;return d.getHigherLevelSiblings(t,"left").every(s=>g(s))}static getHigherLevelSiblings(e,t="left"){let r=e;const n=[];for(;r.parentNode&&r.parentNode.contentEditable!=="true";)r=r.parentNode;const s=t==="left"?"previousSibling":"nextSibling";for(;r[s];)r=r[s],n.push(r);return n}}const C='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',S='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',w="";class m{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:S,title:"List"}}constructor({data:e,config:t,api:r,readOnly:n}){this.nodes={wrapper:null},this.api=r,this.readOnly=n,this.config=t,this.defaultListStyle=this.config.defaultStyle==="ordered"?"ordered":"unordered";const s={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:s,this.caret=new d}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:C},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:S}].map(t=>({name:t.name,icon:t.icon,label:t.label,isActive:this.data.style===t.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=t.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){const t=e.detail.data;this.data=this.pasteHandler(t);const r=this.nodes.wrapper;r&&r.parentNode.replaceChild(this.render(),r)}pasteHandler(e){const{tagName:t}=e;let r,n;switch(t){case"OL":r="ordered",n="ol";break;case"UL":case"LI":r="unordered",n="ul"}const s={style:r,items:[]},o=c=>Array.from(c.querySelectorAll(":scope > li")).map(i=>{var f;const l=i.querySelector(`:scope > ${n}`),y=l?o(l):[];return{content:((f=i==null?void 0:i.firstChild)==null?void 0:f.textContent)||"",items:y}});return s.items=o(e),s}appendItems(e,t){e.forEach(r=>{const n=this.createItem(r.content,r.items);t.appendChild(n)})}createItem(e,t=[]){const r=a("li",this.CSS.item),n=a("div",this.CSS.itemBody),s=a("div",this.CSS.itemContent,{innerHTML:e,contentEditable:!this.readOnly});return n.appendChild(s),r.appendChild(n),t&&t.length>0&&this.addChildrenList(r,t),r}save(){const e=t=>Array.from(t.querySelectorAll(`:scope > .${this.CSS.item}`)).map(n=>{const s=n.querySelector(`.${this.CSS.itemChildren}`),o=this.getItemContent(n),c=s?e(s):[];return{content:o,items:c}});return{style:this.data.style,items:e(this.nodes.wrapper)}}addChildrenList(e,t){const r=e.querySelector(`.${this.CSS.itemBody}`),n=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(t,n),r.appendChild(n)}makeListWrapper(e=this.listStyle,t=[]){const r=e==="ordered"?"ol":"ul",n=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return t.push(n),a(r,[this.CSS.wrapper,...t])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){const t=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));t.push(this.nodes.wrapper),t.forEach(r=>{r.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),r.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){let e=window.getSelection().anchorNode;return e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentNode),e.closest(`.${this.CSS.item}`)}enterPressed(e){const t=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;const r=this.getItemContent(t).trim().length===0,n=t.parentNode===this.nodes.wrapper,s=t.nextElementSibling===null;if(n&&s&&r){this.getOutOfList();return}else if(s&&r){this.unshiftItem();return}const o=d.extractFragmentFromCaretPositionTillTheEnd(),c=u(o),p=t.querySelector(`.${this.CSS.itemChildren}`),i=this.createItem(c,void 0);p&&Array.from(p.querySelectorAll(`.${this.CSS.item}`)).length>0?p.prepend(i):t.after(i),this.focusItem(i)}unshiftItem(){const e=this.currentItem,t=e.parentNode.closest(`.${this.CSS.item}`);if(!t)return;this.caret.save(),t.after(e),this.caret.restore();const r=t.querySelector(`.${this.CSS.itemChildren}`);r.children.length===0&&r.remove()}getItemContent(e){const t=e.querySelector(`.${this.CSS.itemContent}`);return g(t)?"":t.innerHTML}focusItem(e,t=!0){const r=e.querySelector(`.${this.CSS.itemContent}`);d.focus(r,t)}getOutOfList(){this.currentItem.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!d.isAtStart())return;e.preventDefault();const t=this.currentItem,r=t.previousSibling,n=t.parentNode.closest(`.${this.CSS.item}`);if(!r&&!n)return;e.stopPropagation();let s;if(r){const l=r.querySelectorAll(`.${this.CSS.item}`);s=Array.from(l).pop()||r}else s=n;const o=d.extractFragmentFromCaretPositionTillTheEnd(),c=u(o),p=s.querySelector(`.${this.CSS.itemContent}`);d.focus(p,!1),this.caret.save(),p.insertAdjacentHTML("beforeend",c);let i=t.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);i=Array.from(i),i=i.filter(l=>l.parentNode.closest(`.${this.CSS.item}`)===t),i.reverse().forEach(l=>{r?s.after(l):t.after(l)}),t.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();const t=this.currentItem,r=t.previousSibling;if(!r)return;const s=r.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),s)s.appendChild(t);else{const o=this.makeListWrapper(void 0,[this.CSS.itemChildren]),c=r.querySelector(`.${this.CSS.itemBody}`);o.appendChild(t),c.appendChild(o)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(t=>`${t.content} ${m.joinRecursive(t)}`).join("")}static get conversionConfig(){return{export:e=>m.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}}return m});
@@ -0,0 +1,9 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-paragraph[data-placeholder]:empty:before{content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty:before{opacity:1}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph[data-placeholder]:empty:before,.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty:focus:before{opacity:0}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(n=typeof globalThis<"u"?globalThis:n||self,n.Paragraph=i())})(this,function(){"use strict";const n="",i='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';/**
3
+ * Base Paragraph Block for the Editor.js.
4
+ * Represents a regular text block
5
+ *
6
+ * @author CodeX (team@codex.so)
7
+ * @copyright CodeX 2018
8
+ * @license The MIT License (MIT)
9
+ */class s{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:t,config:e,api:a,readOnly:r}){this.api=a,this.readOnly=r,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=e.placeholder?e.placeholder:s.DEFAULT_PLACEHOLDER,this._data={},this._element=null,this._preserveBlank=e.preserveBlank!==void 0?e.preserveBlank:!1,this.data=t}onKeyUp(t){if(t.code!=="Backspace"&&t.code!=="Delete")return;const{textContent:e}=this._element;e===""&&(this._element.innerHTML="")}drawView(){const t=document.createElement("DIV");return t.classList.add(this._CSS.wrapper,this._CSS.block),t.contentEditable=!1,t.dataset.placeholder=this.api.i18n.t(this._placeholder),this._data.text&&(t.innerHTML=this._data.text),this.readOnly||(t.contentEditable=!0,t.addEventListener("keyup",this.onKeyUp)),t}render(){return this._element=this.drawView(),this._element}merge(t){const e={text:this.data.text+t.text};this.data=e}validate(t){return!(t.text.trim()===""&&!this._preserveBlank)}save(t){return{text:t.innerHTML}}onPaste(t){const e={text:t.detail.data.innerHTML};this.data=e}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}get data(){if(this._element!==null){const t=this._element.innerHTML;this._data.text=t}return this._data}set data(t){this._data=t||{},this._element!==null&&this.hydrate()}hydrate(){window.requestAnimationFrame(()=>{this._element.innerHTML=this._data.text||""})}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:i,title:"Text"}}}return s});
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".cdx-quote-icon svg{transform:rotate(180deg)}.cdx-quote{margin:0}.cdx-quote__text{min-height:158px;margin-bottom:10px}.cdx-quote [contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.cdx-quote [contentEditable=true][data-placeholder]:empty:before{opacity:1}.cdx-quote [contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}.cdx-quote-settings{display:flex}.cdx-quote-settings .cdx-settings-button{width:50%}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ (function(s,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(s=typeof globalThis<"u"?globalThis:s||self,s.Quote=o())})(this,function(){"use strict";const s="",o='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 7L6 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 17H6"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 12L8 12"/></svg>',c='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 7L5 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 17H5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13 12L5 12"/></svg>',l='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 10.8182L9 10.8182C8.80222 10.8182 8.60888 10.7649 8.44443 10.665C8.27998 10.5651 8.15181 10.4231 8.07612 10.257C8.00043 10.0909 7.98063 9.90808 8.01922 9.73174C8.0578 9.55539 8.15304 9.39341 8.29289 9.26627C8.43275 9.13913 8.61093 9.05255 8.80491 9.01747C8.99889 8.98239 9.19996 9.00039 9.38268 9.0692C9.56541 9.13801 9.72159 9.25453 9.83147 9.40403C9.94135 9.55353 10 9.72929 10 9.90909L10 12.1818C10 12.664 9.78929 13.1265 9.41421 13.4675C9.03914 13.8084 8.53043 14 8 14"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 10.8182L15 10.8182C14.8022 10.8182 14.6089 10.7649 14.4444 10.665C14.28 10.5651 14.1518 10.4231 14.0761 10.257C14.0004 10.0909 13.9806 9.90808 14.0192 9.73174C14.0578 9.55539 14.153 9.39341 14.2929 9.26627C14.4327 9.13913 14.6109 9.05255 14.8049 9.01747C14.9989 8.98239 15.2 9.00039 15.3827 9.0692C15.5654 9.13801 15.7216 9.25453 15.8315 9.40403C15.9414 9.55353 16 9.72929 16 9.90909L16 12.1818C16 12.664 15.7893 13.1265 15.4142 13.4675C15.0391 13.8084 14.5304 14 14 14"/></svg>';class i{static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:l,title:"Quote"}}static get contentless(){return!0}static get enableLineBreaks(){return!0}static get DEFAULT_QUOTE_PLACEHOLDER(){return"Enter a quote"}static get DEFAULT_CAPTION_PLACEHOLDER(){return"Enter a caption"}static get ALIGNMENTS(){return{left:"left",center:"center"}}static get DEFAULT_ALIGNMENT(){return i.ALIGNMENTS.left}static get conversionConfig(){return{import:"text",export:function(t){return t.caption?`${t.text} — ${t.caption}`:t.text}}}get CSS(){return{baseClass:this.api.styles.block,wrapper:"cdx-quote",text:"cdx-quote__text",input:this.api.styles.input,caption:"cdx-quote__caption"}}get settings(){return[{name:"left",icon:c},{name:"center",icon:o}]}constructor({data:t,config:e,api:n,readOnly:r}){const{ALIGNMENTS:a,DEFAULT_ALIGNMENT:d}=i;this.api=n,this.readOnly=r,this.quotePlaceholder=e.quotePlaceholder||i.DEFAULT_QUOTE_PLACEHOLDER,this.captionPlaceholder=e.captionPlaceholder||i.DEFAULT_CAPTION_PLACEHOLDER,this.data={text:t.text||"",caption:t.caption||"",alignment:Object.values(a).includes(t.alignment)&&t.alignment||e.defaultAlignment||d}}render(){const t=this._make("blockquote",[this.CSS.baseClass,this.CSS.wrapper]),e=this._make("div",[this.CSS.input,this.CSS.text],{contentEditable:!this.readOnly,innerHTML:this.data.text}),n=this._make("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly,innerHTML:this.data.caption});return e.dataset.placeholder=this.quotePlaceholder,n.dataset.placeholder=this.captionPlaceholder,t.appendChild(e),t.appendChild(n),t}save(t){const e=t.querySelector(`.${this.CSS.text}`),n=t.querySelector(`.${this.CSS.caption}`);return Object.assign(this.data,{text:e.innerHTML,caption:n.innerHTML})}static get sanitize(){return{text:{br:!0},caption:{br:!0},alignment:{}}}renderSettings(){const t=e=>e[0].toUpperCase()+e.substr(1);return this.settings.map(e=>({icon:e.icon,label:this.api.i18n.t(`Align ${t(e.name)}`),onActivate:()=>this._toggleTune(e.name),isActive:this.data.alignment===e.name,closeOnActivate:!0}))}_toggleTune(t){this.data.alignment=t}_make(t,e=null,n={}){const r=document.createElement(t);Array.isArray(e)?r.classList.add(...e):e&&r.classList.add(e);for(const a in n)r[a]=n[a];return r}}return i});
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".cdx-simple-image .cdx-loader{min-height:200px}.cdx-simple-image .cdx-input{margin-top:10px}.cdx-simple-image img{max-width:100%;vertical-align:bottom}.cdx-simple-image__caption[contentEditable=true][data-placeholder]:empty:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.cdx-simple-image__caption[contentEditable=true][data-placeholder]:empty:before{opacity:1}.cdx-simple-image__caption[contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}.cdx-simple-image__picture--with-background{background:#eff2f5;padding:10px}.cdx-simple-image__picture--with-background img{display:block;max-width:60%;margin:0 auto}.cdx-simple-image__picture--with-border{border:1px solid #e8e8eb;padding:1px}.cdx-simple-image__picture--stretched img{max-width:none;width:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(s,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(s=typeof globalThis<"u"?globalThis:s||self,s.SimpleImage=n())})(this,function(){"use strict";const s="",n='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',a='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',d='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>';class l{constructor({data:e,config:t,api:r,readOnly:i}){this.api=r,this.readOnly=i,this.blockIndex=this.api.blocks.getCurrentBlockIndex()+1,this.CSS={baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,wrapper:"cdx-simple-image",imageHolder:"cdx-simple-image__picture",caption:"cdx-simple-image__caption"},this.nodes={wrapper:null,imageHolder:null,image:null,caption:null},this.data={url:e.url||"",caption:e.caption||"",withBorder:e.withBorder!==void 0?e.withBorder:!1,withBackground:e.withBackground!==void 0?e.withBackground:!1,stretched:e.stretched!==void 0?e.stretched:!1},this.tunes=[{name:"withBorder",label:"Add Border",icon:a},{name:"stretched",label:"Stretch Image",icon:d},{name:"withBackground",label:"Add Background",icon:n}]}render(){const e=this._make("div",[this.CSS.baseClass,this.CSS.wrapper]),t=this._make("div",this.CSS.loading),r=this._make("div",this.CSS.imageHolder),i=this._make("img"),o=this._make("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly,innerHTML:this.data.caption||""});return o.dataset.placeholder="Enter a caption",e.appendChild(t),this.data.url&&(i.src=this.data.url),i.onload=()=>{e.classList.remove(this.CSS.loading),r.appendChild(i),e.appendChild(r),e.appendChild(o),t.remove(),this._acceptTuneView()},i.onerror=h=>{console.log("Failed to load an image",h)},this.nodes.imageHolder=r,this.nodes.wrapper=e,this.nodes.image=i,this.nodes.caption=o,e}save(e){const t=e.querySelector("img"),r=e.querySelector("."+this.CSS.input);return t?Object.assign(this.data,{url:t.src,caption:r.innerHTML}):this.data}static get sanitize(){return{url:{},withBorder:{},withBackground:{},stretched:{},caption:{br:!0}}}static get isReadOnlySupported(){return!0}onDropHandler(e){const t=new FileReader;return t.readAsDataURL(e),new Promise(r=>{t.onload=i=>{r({url:i.target.result,caption:e.name})}})}onPaste(e){switch(e.type){case"tag":{const t=e.detail.data;this.data={url:t.src};break}case"pattern":{const{data:t}=e.detail;this.data={url:t};break}case"file":{const{file:t}=e.detail;this.onDropHandler(t).then(r=>{this.data=r});break}}}get data(){return this._data}set data(e){this._data=Object.assign({},this.data,e),this.nodes.image&&(this.nodes.image.src=this.data.url),this.nodes.caption&&(this.nodes.caption.innerHTML=this.data.caption)}static get pasteConfig(){return{patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|webp)$/i},tags:[{img:{src:!0}}],files:{mimeTypes:["image/*"]}}}renderSettings(){return this.tunes.map(e=>({...e,label:this.api.i18n.t(e.label),toggle:!0,onActivate:()=>this._toggleTune(e.name),isActive:!!this.data[e.name]}))}_make(e,t=null,r={}){const i=document.createElement(e);Array.isArray(t)?i.classList.add(...t):t&&i.classList.add(t);for(const o in r)i[o]=r[o];return i}_toggleTune(e){this.data[e]=!this.data[e],this._acceptTuneView()}_acceptTuneView(){this.tunes.forEach(e=>{this.nodes.imageHolder.classList.toggle(this.CSS.imageHolder+"--"+e.name.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`),!!this.data[e.name]),e.name==="stretched"&&this.api.blocks.stretchBlock(this.blockIndex,!!this.data.stretched)})}}return l});
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.tc-wrap{--color-background:#f9f9fb;--color-text-secondary:#7b7e89;--color-border:#e8e8eb;--cell-size:34px;--toolbox-icon-size:18px;--toolbox-padding:6px;--toolbox-aiming-field-size:calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);border-left:0;position:relative;height:100%;width:100%;margin-top:var(--toolbox-icon-size);box-sizing:border-box;display:grid;grid-template-columns:calc(100% - var(--cell-size)) var(--cell-size)}.tc-wrap--readonly{grid-template-columns:100% var(--cell-size)}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px;grid-template-columns:100% var(--cell-size)}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);line-height:1.4}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{padding:4px 0;justify-content:center;border-top:1px solid var(--color-border)}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);align-items:center;padding-left:4px;position:relative}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(10px,1fr));position:relative;border-bottom:1px solid var(--color-border)}.tc-row:after{content:"";pointer-events:none;position:absolute;width:var(--cell-size);height:100%;bottom:-1px;right:calc(var(--cell-size)*-1);border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding:6px;--popover-margin:30px;--toggler-click-zone-size:30px;--toggler-dots-color:#7b7e89;--toggler-dots-color-hovered:#1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:flex;align-items:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border:#eaeaea;--color-background:#fff;--color-background-hover:rgba(232,232,235,.49);--color-background-confirm:#e24a4a;--color-background-confirm-hover:#d54040;--color-text-confirm:#fff;background:var(--color-background);border:1px solid var(--color-border);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:block;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:flex;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{transition:transform .2s ease-in;transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@keyframes menuShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ (function(d,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(d=typeof globalThis<"u"?globalThis:d||self,d.Table=w())})(this,function(){"use strict";function d(a,e,t={}){const o=document.createElement(a);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(o[i]=t[i]);return o}function w(a){const e=a.getBoundingClientRect();return{y1:Math.floor(e.top+window.pageYOffset),x1:Math.floor(e.left+window.pageXOffset),x2:Math.floor(e.right+window.pageXOffset),y2:Math.floor(e.bottom+window.pageYOffset)}}function g(a,e){const t=w(a),o=w(e);return{fromTopBorder:o.y1-t.y1,fromLeftBorder:o.x1-t.x1,fromRightBorder:t.x2-o.x2,fromBottomBorder:t.y2-o.y2}}function R(a,e){const t=a.getBoundingClientRect(),{width:o,height:i,x:r,y:n}=t,{clientX:h,clientY:l}=e;return{width:o,height:i,x:h-r,y:l-n}}function C(a,e){return e.parentNode.insertBefore(a,e)}function m(a,e=!0){const t=document.createRange(),o=window.getSelection();t.selectNodeContents(a),t.collapse(e),o.removeAllRanges(),o.addRange(t)}class c{constructor({items:e}){this.items=e,this.wrapper=void 0,this.itemEls=[]}static get CSS(){return{popover:"tc-popover",popoverOpened:"tc-popover--opened",item:"tc-popover__item",itemHidden:"tc-popover__item--hidden",itemConfirmState:"tc-popover__item--confirm",itemIcon:"tc-popover__item-icon",itemLabel:"tc-popover__item-label"}}render(){return this.wrapper=d("div",c.CSS.popover),this.items.forEach((e,t)=>{const o=d("div",c.CSS.item),i=d("div",c.CSS.itemIcon,{innerHTML:e.icon}),r=d("div",c.CSS.itemLabel,{textContent:e.label});o.dataset.index=t,o.appendChild(i),o.appendChild(r),this.wrapper.appendChild(o),this.itemEls.push(o)}),this.wrapper.addEventListener("click",e=>{this.popoverClicked(e)}),this.wrapper}popoverClicked(e){const t=e.target.closest(`.${c.CSS.item}`);if(!t)return;const o=t.dataset.index,i=this.items[o];if(i.confirmationRequired&&!this.hasConfirmationState(t)){this.setConfirmationState(t);return}i.onClick()}setConfirmationState(e){e.classList.add(c.CSS.itemConfirmState)}clearConfirmationState(e){e.classList.remove(c.CSS.itemConfirmState)}hasConfirmationState(e){return e.classList.contains(c.CSS.itemConfirmState)}get opened(){return this.wrapper.classList.contains(c.CSS.popoverOpened)}open(){this.items.forEach((e,t)=>{typeof e.hideIf=="function"&&this.itemEls[t].classList.toggle(c.CSS.itemHidden,e.hideIf())}),this.wrapper.classList.add(c.CSS.popoverOpened)}close(){this.wrapper.classList.remove(c.CSS.popoverOpened),this.itemEls.forEach(e=>{this.clearConfirmationState(e)})}}const b='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',k='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 9.16666L18.2167 12.5M18.2167 12.5L14.8833 15.8333M18.2167 12.5H10.05C9.16594 12.5 8.31809 12.1488 7.69297 11.5237C7.06785 10.8986 6.71666 10.0507 6.71666 9.16666"/></svg>',S='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>',x='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.13333 14.9167L12.4667 18.25M12.4667 18.25L15.8 14.9167M12.4667 18.25L12.4667 10.0833C12.4667 9.19928 12.1155 8.35143 11.4904 7.72631C10.8652 7.10119 10.0174 6.75 9.13333 6.75"/></svg>',y='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>',T='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>',v='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',L='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',M='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M14 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><path stroke="currentColor" stroke-width="2" d="M5 14H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',O='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>';class u{constructor({api:e,items:t,onOpen:o,onClose:i,cssModifier:r=""}){this.api=e,this.items=t,this.onOpen=o,this.onClose=i,this.cssModifier=r,this.popover=null,this.wrapper=this.createToolbox()}static get CSS(){return{toolbox:"tc-toolbox",toolboxShowed:"tc-toolbox--showed",toggler:"tc-toolbox__toggler"}}get element(){return this.wrapper}createToolbox(){const e=d("div",[u.CSS.toolbox,this.cssModifier?`${u.CSS.toolbox}--${this.cssModifier}`:""]);e.dataset.mutationFree="true";const t=this.createPopover(),o=this.createToggler();return e.appendChild(o),e.appendChild(t),e}createToggler(){const e=d("div",u.CSS.toggler,{innerHTML:T});return e.addEventListener("click",()=>{this.togglerClicked()}),e}createPopover(){return this.popover=new c({items:this.items}),this.popover.render()}togglerClicked(){this.popover.opened?(this.popover.close(),this.onClose()):(this.popover.open(),this.onOpen())}show(e){const t=e();Object.entries(t).forEach(([o,i])=>{this.wrapper.style[o]=i}),this.wrapper.classList.add(u.CSS.toolboxShowed)}hide(){this.popover.close(),this.wrapper.classList.remove(u.CSS.toolboxShowed)}}function H(a,e){let t=0;return function(...o){const i=new Date().getTime();if(!(i-t<a))return t=i,e(...o)}}const s={wrapper:"tc-wrap",wrapperReadOnly:"tc-wrap--readonly",table:"tc-table",row:"tc-row",withHeadings:"tc-table--heading",rowSelected:"tc-row--selected",cell:"tc-cell",cellSelected:"tc-cell--selected",addRow:"tc-add-row",addColumn:"tc-add-column"};class A{constructor(e,t,o,i){this.readOnly=e,this.api=t,this.data=o,this.config=i,this.wrapper=null,this.table=null,this.toolboxColumn=this.createColumnToolbox(),this.toolboxRow=this.createRowToolbox(),this.createTableWrapper(),this.hoveredRow=0,this.hoveredColumn=0,this.selectedRow=0,this.selectedColumn=0,this.tunes={withHeadings:!1},this.resize(),this.fill(),this.focusedCell={row:0,column:0},this.documentClicked=r=>{const n=r.target.closest(`.${s.table}`)!==null,h=r.target.closest(`.${s.wrapper}`)===null;(n||h)&&this.hideToolboxes();const p=r.target.closest(`.${s.addRow}`),f=r.target.closest(`.${s.addColumn}`);p&&p.parentNode===this.wrapper?(this.addRow(void 0,!0),this.hideToolboxes()):f&&f.parentNode===this.wrapper&&(this.addColumn(void 0,!0),this.hideToolboxes())},this.readOnly||this.bindEvents()}getWrapper(){return this.wrapper}bindEvents(){document.addEventListener("click",this.documentClicked),this.table.addEventListener("mousemove",H(150,e=>this.onMouseMoveInTable(e)),{passive:!0}),this.table.onkeypress=e=>this.onKeyPressListener(e),this.table.addEventListener("keydown",e=>this.onKeyDownListener(e)),this.table.addEventListener("focusin",e=>this.focusInTableListener(e))}createColumnToolbox(){return new u({api:this.api,cssModifier:"column",items:[{label:this.api.i18n.t("Add column to left"),icon:S,onClick:()=>{this.addColumn(this.selectedColumn,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add column to right"),icon:x,onClick:()=>{this.addColumn(this.selectedColumn+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete column"),icon:b,hideIf:()=>this.numberOfColumns===1,confirmationRequired:!0,onClick:()=>{this.deleteColumn(this.selectedColumn),this.hideToolboxes()}}],onOpen:()=>{this.selectColumn(this.hoveredColumn),this.hideRowToolbox()},onClose:()=>{this.unselectColumn()}})}createRowToolbox(){return new u({api:this.api,cssModifier:"row",items:[{label:this.api.i18n.t("Add row above"),icon:y,onClick:()=>{this.addRow(this.selectedRow,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add row below"),icon:k,onClick:()=>{this.addRow(this.selectedRow+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete row"),icon:b,hideIf:()=>this.numberOfRows===1,confirmationRequired:!0,onClick:()=>{this.deleteRow(this.selectedRow),this.hideToolboxes()}}],onOpen:()=>{this.selectRow(this.hoveredRow),this.hideColumnToolbox()},onClose:()=>{this.unselectRow()}})}moveCursorToNextRow(){this.focusedCell.row!==this.numberOfRows?(this.focusedCell.row+=1,this.focusCell(this.focusedCell)):(this.addRow(),this.focusedCell.row+=1,this.focusCell(this.focusedCell),this.updateToolboxesPosition(0,0))}getCell(e,t){return this.table.querySelectorAll(`.${s.row}:nth-child(${e}) .${s.cell}`)[t-1]}getRow(e){return this.table.querySelector(`.${s.row}:nth-child(${e})`)}getRowByCell(e){return e.parentElement}getRowFirstCell(e){return e.querySelector(`.${s.cell}:first-child`)}setCellContent(e,t,o){const i=this.getCell(e,t);i.innerHTML=o}addColumn(e=-1,t=!1){let o=this.numberOfColumns;for(let i=1;i<=this.numberOfRows;i++){let r;const n=this.createCell();if(e>0&&e<=o?(r=this.getCell(i,e),C(n,r)):r=this.getRow(i).appendChild(n),i===1){const h=this.getCell(i,e>0?e:o+1);h&&t&&m(h)}}this.addHeadingAttrToFirstRow()}addRow(e=-1,t=!1){let o,i=d("div",s.row);this.tunes.withHeadings&&this.removeHeadingAttrFromFirstRow();let r=this.numberOfColumns;if(e>0&&e<=this.numberOfRows){let h=this.getRow(e);o=C(i,h)}else o=this.table.appendChild(i);this.fillRow(o,r),this.tunes.withHeadings&&this.addHeadingAttrToFirstRow();const n=this.getRowFirstCell(o);return n&&t&&m(n),o}deleteColumn(e){for(let t=1;t<=this.numberOfRows;t++){const o=this.getCell(t,e);if(!o)return;o.remove()}}deleteRow(e){this.getRow(e).remove(),this.addHeadingAttrToFirstRow()}createTableWrapper(){if(this.wrapper=d("div",s.wrapper),this.table=d("div",s.table),this.readOnly&&this.wrapper.classList.add(s.wrapperReadOnly),this.wrapper.appendChild(this.toolboxRow.element),this.wrapper.appendChild(this.toolboxColumn.element),this.wrapper.appendChild(this.table),!this.readOnly){const e=d("div",s.addColumn,{innerHTML:v}),t=d("div",s.addRow,{innerHTML:v});this.wrapper.appendChild(e),this.wrapper.appendChild(t)}}computeInitialSize(){const e=this.data&&this.data.content,t=Array.isArray(e),o=t?e.length:!1,i=t?e.length:void 0,r=o?e[0].length:void 0,n=Number.parseInt(this.config&&this.config.rows),h=Number.parseInt(this.config&&this.config.cols),l=!isNaN(n)&&n>0?n:void 0,p=!isNaN(h)&&h>0?h:void 0;return{rows:i||l||2,cols:r||p||2}}resize(){const{rows:e,cols:t}=this.computeInitialSize();for(let o=0;o<e;o++)this.addRow();for(let o=0;o<t;o++)this.addColumn()}fill(){const e=this.data;if(e&&e.content)for(let t=0;t<e.content.length;t++)for(let o=0;o<e.content[t].length;o++)this.setCellContent(t+1,o+1,e.content[t][o])}fillRow(e,t){for(let o=1;o<=t;o++){const i=this.createCell();e.appendChild(i)}}createCell(){return d("div",s.cell,{contentEditable:!this.readOnly})}get numberOfRows(){return this.table.childElementCount}get numberOfColumns(){return this.numberOfRows?this.table.querySelectorAll(`.${s.row}:first-child .${s.cell}`).length:0}get isColumnMenuShowing(){return this.selectedColumn!==0}get isRowMenuShowing(){return this.selectedRow!==0}onMouseMoveInTable(e){const{row:t,column:o}=this.getHoveredCell(e);this.hoveredColumn=o,this.hoveredRow=t,this.updateToolboxesPosition()}onKeyPressListener(e){if(e.key==="Enter"){if(e.shiftKey)return!0;this.moveCursorToNextRow()}return e.key!=="Enter"}onKeyDownListener(e){e.key==="Tab"&&e.stopPropagation()}focusInTableListener(e){const t=e.target,o=this.getRowByCell(t);this.focusedCell={row:Array.from(this.table.querySelectorAll(`.${s.row}`)).indexOf(o)+1,column:Array.from(o.querySelectorAll(`.${s.cell}`)).indexOf(t)+1}}hideToolboxes(){this.hideRowToolbox(),this.hideColumnToolbox(),this.updateToolboxesPosition()}hideRowToolbox(){this.unselectRow(),this.toolboxRow.hide()}hideColumnToolbox(){this.unselectColumn(),this.toolboxColumn.hide()}focusCell(){this.focusedCellElem.focus()}get focusedCellElem(){const{row:e,column:t}=this.focusedCell;return this.getCell(e,t)}updateToolboxesPosition(e=this.hoveredRow,t=this.hoveredColumn){this.isColumnMenuShowing||t>0&&t<=this.numberOfColumns&&this.toolboxColumn.show(()=>({left:`calc((100% - var(--cell-size)) / (${this.numberOfColumns} * 2) * (1 + (${t} - 1) * 2))`})),this.isRowMenuShowing||e>0&&e<=this.numberOfRows&&this.toolboxRow.show(()=>{const o=this.getRow(e),{fromTopBorder:i}=g(this.table,o),{height:r}=o.getBoundingClientRect();return{top:`${Math.ceil(i+r/2)}px`}})}setHeadingsSetting(e){this.tunes.withHeadings=e,e?(this.table.classList.add(s.withHeadings),this.addHeadingAttrToFirstRow()):(this.table.classList.remove(s.withHeadings),this.removeHeadingAttrFromFirstRow())}addHeadingAttrToFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.setAttribute("heading",this.api.i18n.t("Heading"))}}removeHeadingAttrFromFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.removeAttribute("heading")}}selectRow(e){const t=this.getRow(e);t&&(this.selectedRow=e,t.classList.add(s.rowSelected))}unselectRow(){if(this.selectedRow<=0)return;const e=this.table.querySelector(`.${s.rowSelected}`);e&&e.classList.remove(s.rowSelected),this.selectedRow=0}selectColumn(e){for(let t=1;t<=this.numberOfRows;t++){const o=this.getCell(t,e);o&&o.classList.add(s.cellSelected)}this.selectedColumn=e}unselectColumn(){if(this.selectedColumn<=0)return;let e=this.table.querySelectorAll(`.${s.cellSelected}`);Array.from(e).forEach(t=>{t.classList.remove(s.cellSelected)}),this.selectedColumn=0}getHoveredCell(e){let t=this.hoveredRow,o=this.hoveredColumn;const{width:i,height:r,x:n,y:h}=R(this.table,e);return n>=0&&(o=this.binSearch(this.numberOfColumns,l=>this.getCell(1,l),({fromLeftBorder:l})=>n<l,({fromRightBorder:l})=>n>i-l)),h>=0&&(t=this.binSearch(this.numberOfRows,l=>this.getCell(l,1),({fromTopBorder:l})=>h<l,({fromBottomBorder:l})=>h>r-l)),{row:t||this.hoveredRow,column:o||this.hoveredColumn}}binSearch(e,t,o,i){let r=0,n=e+1,h=0,l;for(;r<n-1&&h<10;){l=Math.ceil((r+n)/2);const p=t(l),f=g(this.table,p);if(o(f))n=l;else if(i(f))r=l;else break;h++}return l}getData(){const e=[];for(let t=1;t<=this.numberOfRows;t++){const o=this.table.querySelector(`.${s.row}:nth-child(${t})`),i=Array.from(o.querySelectorAll(`.${s.cell}`));i.every(n=>!n.textContent.trim())||e.push(i.map(n=>n.innerHTML))}return e}destroy(){document.removeEventListener("click",this.documentClicked)}}class E{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:o,readOnly:i}){this.api=o,this.readOnly=i,this.config=t,this.data={withHeadings:this.getConfig("withHeadings",!1,e),content:e&&e.content?e.content:[]},this.table=null}static get toolbox(){return{icon:O,title:"Table"}}render(){return this.table=new A(this.readOnly,this.api,this.data,this.config),this.container=d("div",this.api.styles.block),this.container.appendChild(this.table.getWrapper()),this.table.setHeadingsSetting(this.data.withHeadings),this.container}renderSettings(){return[{label:this.api.i18n.t("With headings"),icon:L,isActive:this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!0,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.api.i18n.t("Without headings"),icon:M,isActive:!this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!1,this.table.setHeadingsSetting(this.data.withHeadings)}}]}save(){const e=this.table.getData();return{withHeadings:this.data.withHeadings,content:e}}destroy(){this.table.destroy()}getConfig(e,t=void 0,o=void 0){const i=this.data||o;return i?i[e]?i[e]:t:this.config&&this.config[e]?this.config[e]:t}static get pasteConfig(){return{tags:["TABLE","TR","TH","TD"]}}onPaste(e){const t=e.detail.data,o=t.querySelector(":scope > thead, tr:first-of-type th"),r=Array.from(t.querySelectorAll("tr")).map(n=>Array.from(n.querySelectorAll("th, td")).map(l=>l.innerHTML));this.data={withHeadings:o!==null,content:r},this.table.wrapper&&this.table.wrapper.replaceWith(this.render())}}const B="";return E});
@@ -1,12 +1,11 @@
1
1
  import EditorJS from "@editorjs/editorjs"
2
2
  import Paragraph from "@editorjs/paragraph"
3
3
  import Header from "@editorjs/header"
4
- import List from "@editorjs/list"
5
4
  import Quote from "@editorjs/quote"
6
5
  import Table from "@editorjs/table"
7
6
  import NestedList from "@editorjs/nested-list"
8
- import FootnoteTool from "./tools/footnote_tool"
9
- import ParagraphWithFootnotes from "./tools/paragraph_with_footnotes"
7
+ import FootnoteTool from "./tools/footnote_tool.js"
8
+ import ParagraphWithFootnotes from "./tools/paragraph_with_footnotes.js"
10
9
 
11
10
  export default class RichTextEditor {
12
11
  constructor(element, iframe) {
@@ -9,78 +9,78 @@ module Panda
9
9
  return {} if html.blank?
10
10
 
11
11
  # If it's already in EditorJS format, return as is
12
- return html if html.is_a?(Hash) && (html['blocks'].present? || html[:blocks].present?)
12
+ return html if html.is_a?(Hash) && (html["blocks"].present? || html[:blocks].present?)
13
13
 
14
14
  begin
15
15
  # Parse the HTML content
16
16
  doc = Nokogiri::HTML.fragment(html.to_s)
17
- raise ConversionError, 'Failed to parse HTML content' unless doc
17
+ raise ConversionError, "Failed to parse HTML content" unless doc
18
18
 
19
19
  blocks = []
20
- current_text = ''
20
+ current_text = ""
21
21
 
22
22
  doc.children.each do |node|
23
23
  case node.name
24
- when 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
24
+ when "h1", "h2", "h3", "h4", "h5", "h6"
25
25
  # Add any accumulated text as a paragraph before the header
26
26
  if current_text.present?
27
27
  blocks << create_paragraph_block(current_text)
28
- current_text = ''
28
+ current_text = ""
29
29
  end
30
30
 
31
31
  blocks << {
32
- 'type' => 'header',
33
- 'data' => {
34
- 'text' => node.text.strip,
35
- 'level' => node.name[1].to_i
32
+ "type" => "header",
33
+ "data" => {
34
+ "text" => node.text.strip,
35
+ "level" => node.name[1].to_i
36
36
  }
37
37
  }
38
- when 'p', 'div'
38
+ when "p", "div"
39
39
  # Add any accumulated text first
40
40
  if current_text.present?
41
41
  blocks << create_paragraph_block(current_text)
42
- current_text = ''
42
+ current_text = ""
43
43
  end
44
44
 
45
- if node.name == 'div'
45
+ if node.name == "div"
46
46
  # Process div children separately
47
47
  node.children.each do |child|
48
48
  case child.name
49
- when 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
49
+ when "h1", "h2", "h3", "h4", "h5", "h6"
50
50
  blocks << {
51
- 'type' => 'header',
52
- 'data' => {
53
- 'text' => child.text.strip,
54
- 'level' => child.name[1].to_i
51
+ "type" => "header",
52
+ "data" => {
53
+ "text" => child.text.strip,
54
+ "level" => child.name[1].to_i
55
55
  }
56
56
  }
57
- when 'p'
57
+ when "p"
58
58
  text = process_inline_elements(child)
59
59
  paragraphs = text.split(%r{<br\s*/?>\s*<br\s*/?>}).map(&:strip)
60
60
  paragraphs.each do |paragraph|
61
61
  blocks << create_paragraph_block(paragraph) if paragraph.present?
62
62
  end
63
- when 'ul', 'ol'
64
- items = child.css('li').map { |li| process_inline_elements(li) }
63
+ when "ul", "ol"
64
+ items = child.css("li").map { |li| process_inline_elements(li) }
65
65
  next if items.empty?
66
66
 
67
67
  blocks << {
68
- 'type' => 'list',
69
- 'data' => {
70
- 'style' => child.name == 'ul' ? 'unordered' : 'ordered',
71
- 'items' => items
68
+ "type" => "list",
69
+ "data" => {
70
+ "style" => (child.name == "ul") ? "unordered" : "ordered",
71
+ "items" => items
72
72
  }
73
73
  }
74
- when 'blockquote'
74
+ when "blockquote"
75
75
  blocks << {
76
- 'type' => 'quote',
77
- 'data' => {
78
- 'text' => process_inline_elements(child),
79
- 'caption' => '',
80
- 'alignment' => 'left'
76
+ "type" => "quote",
77
+ "data" => {
78
+ "text" => process_inline_elements(child),
79
+ "caption" => "",
80
+ "alignment" => "left"
81
81
  }
82
82
  }
83
- when 'text'
83
+ when "text"
84
84
  text = child.text.strip
85
85
  current_text += text if text.present?
86
86
  end
@@ -93,41 +93,41 @@ module Panda
93
93
  blocks << create_paragraph_block(paragraph) if paragraph.present?
94
94
  end
95
95
  end
96
- when 'br'
96
+ when "br"
97
97
  current_text += "\n\n"
98
- when 'text'
98
+ when "text"
99
99
  text = node.text.strip
100
100
  current_text += text if text.present?
101
- when 'ul', 'ol'
101
+ when "ul", "ol"
102
102
  # Add any accumulated text first
103
103
  if current_text.present?
104
104
  blocks << create_paragraph_block(current_text)
105
- current_text = ''
105
+ current_text = ""
106
106
  end
107
107
 
108
- items = node.css('li').map { |li| process_inline_elements(li) }
108
+ items = node.css("li").map { |li| process_inline_elements(li) }
109
109
  next if items.empty?
110
110
 
111
111
  blocks << {
112
- 'type' => 'list',
113
- 'data' => {
114
- 'style' => node.name == 'ul' ? 'unordered' : 'ordered',
115
- 'items' => items
112
+ "type" => "list",
113
+ "data" => {
114
+ "style" => (node.name == "ul") ? "unordered" : "ordered",
115
+ "items" => items
116
116
  }
117
117
  }
118
- when 'blockquote'
118
+ when "blockquote"
119
119
  # Add any accumulated text first
120
120
  if current_text.present?
121
121
  blocks << create_paragraph_block(current_text)
122
- current_text = ''
122
+ current_text = ""
123
123
  end
124
124
 
125
125
  blocks << {
126
- 'type' => 'quote',
127
- 'data' => {
128
- 'text' => process_inline_elements(node),
129
- 'caption' => '',
130
- 'alignment' => 'left'
126
+ "type" => "quote",
127
+ "data" => {
128
+ "text" => process_inline_elements(node),
129
+ "caption" => "",
130
+ "alignment" => "left"
131
131
  }
132
132
  }
133
133
  end
@@ -138,11 +138,11 @@ module Panda
138
138
 
139
139
  # Return the complete EditorJS structure
140
140
  {
141
- 'time' => Time.current.to_i * 1000,
142
- 'blocks' => blocks,
143
- 'version' => '2.28.2'
141
+ "time" => Time.current.to_i * 1000,
142
+ "blocks" => blocks,
143
+ "version" => "2.28.2"
144
144
  }
145
- rescue StandardError => e
145
+ rescue => e
146
146
  Rails.logger.error "HTML to EditorJS conversion failed: #{e.message}"
147
147
  Rails.logger.error e.backtrace.join("\n")
148
148
  raise ConversionError, "Failed to convert HTML to EditorJS format: #{e.message}"
@@ -151,41 +151,41 @@ module Panda
151
151
 
152
152
  def self.create_paragraph_block(text)
153
153
  {
154
- 'type' => 'paragraph',
155
- 'data' => {
156
- 'text' => text.strip
154
+ "type" => "paragraph",
155
+ "data" => {
156
+ "text" => text.strip
157
157
  }
158
158
  }
159
159
  end
160
160
 
161
161
  def self.process_inline_elements(node)
162
- result = ''
162
+ result = ""
163
163
  node.children.each do |child|
164
164
  case child.name
165
- when 'br'
166
- result += '<br>'
167
- when 'text'
165
+ when "br"
166
+ result += "<br>"
167
+ when "text"
168
168
  result += child.text
169
- when 'strong', 'b'
169
+ when "strong", "b"
170
170
  result += "<b>#{child.text}</b>"
171
- when 'em', 'i'
171
+ when "em", "i"
172
172
  result += "<i>#{child.text}</i>"
173
- when 'a'
174
- href = child['href']
173
+ when "a"
174
+ href = child["href"]
175
175
  text = child.text.strip
176
176
  # Handle email links specially
177
- if href&.start_with?('mailto:')
178
- email = href.sub('mailto:', '')
177
+ if href&.start_with?("mailto:")
178
+ email = href.sub("mailto:", "")
179
179
  result += "<a href=\"mailto:#{email}\">#{text}</a>"
180
180
  else
181
181
  result += "<a href=\"#{href}\">#{text}</a>"
182
182
  end
183
183
  else
184
184
  result += if child.text?
185
- child.text
186
- else
187
- child.to_html
188
- end
185
+ child.text
186
+ else
187
+ child.to_html
188
+ end
189
189
  end
190
190
  end
191
191
  result.strip