@paroicms/tiptap-editor-plugin 1.0.6 → 1.0.7

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.
@@ -430,7 +430,7 @@ function Hc(n){return typeof n=="object"&&n!==null&&"j"in n}const Hf={en:{en:"En
430
430
  .PlatformVideo:hover .PlatformVideo-playButton {
431
431
  background: rgba(0, 0, 0, 0.9);
432
432
  }
433
- `,Cv=it.create({name:"textSize",addAttributes(){return{value:{default:null,parseHTML:n=>n.classList.contains("text-size-small")?"small":n.classList.contains("text-size-large")?"large":n.classList.contains("text-size-huge")?"huge":null,renderHTML:n=>n.value?{class:`text-size-${n.value}`}:{}}}},keepOnSplit:!1,parseHTML(){return[{tag:"span.text-size-small"},{tag:"span.text-size-large"},{tag:"span.text-size-huge"}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}});var Mv=Object.defineProperty,Av=Object.getOwnPropertyDescriptor,rn=(n,e,t,r)=>{for(var i=r>1?void 0:r?Av(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Mv(e,t,i),i};const Nv=t0.extend({content:"block*"}),_v=ma.extend({content:"block*"});let kt=class extends Yt{firstUpdated(){const t=`calc(${this.service.fieldType.adminUi?.editorRows??26}rem + 79px)`;this.style.setProperty("--content-height",t);const r=this.shadowRoot?.querySelector(".tiptap-content");if(!r)return;const i=this.service.configuration.code??!1;this.editor=new Oy({element:r,extensions:[Nv,rv,Uk.configure({document:!1,bulletList:!1,orderedList:!1,listItem:!1,heading:{levels:[2,3,4]},code:i?!1:void 0,codeBlock:i?!1:void 0,link:!1}),pa,ba,_v,uv.configure({openOnClick:!1,service:this.service,i18n:this.i18n}),k0.configure({types:["heading","paragraph"]}),rh,Cv,m0,b0,...this.service.configuration.code?[Vy,(()=>{const s=this.i18n;return e0.extend({addNodeView(){return({node:o,editor:a,getPos:l,decorations:c})=>new QE(o,a,l,c,s)}}).configure({lowlight:Hh,defaultLanguage:"plaintext",languageClassPrefix:"language-",HTMLAttributes:{class:"code-block"}})})()]:[],gv.configure({service:this.service,getLanguage:()=>this.service.language,i18n:this.i18n}),iv.configure({service:this.service,i18n:this.i18n}),vv.configure({service:this.service,i18n:this.i18n}),wv.configure({service:this.service,i18n:this.i18n,videoPluginHook:this.videoPluginHook}),ov.configure({service:this.service,i18n:this.i18n,internalLinkPluginHook:this.internalLinkPluginHook})],content:this.initialContent,editable:!0,editorProps:{handlePaste:(s,o)=>hv(s,o,this.editor,this.service,this.i18n,this.videoPluginHook),handleDrop:(s,o)=>fv(s,o,this.editor,this.service,this.i18n)},onCreate:({editor:s})=>{s.view.updateState(s.view.state);const o=s.state.tr,a=H.create(o.doc,1);o.setSelection(a).setMeta("addToHistory",!1),s.view.dispatch(o)},onUpdate:({editor:s,transaction:o})=>{this.onChange&&this.onChange(s.getJSON()),this.toolbarRef?.refresh(),this.videoPluginHook&&o.docChanged&&Sv(s,this.videoPluginHook)},onSelectionUpdate:()=>{this.toolbarRef?.refresh()}})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy()}setContent(n){this.editor?.commands.setContent(n)}getJSON(){return this.editor?.getJSON()}updateLanguage(n){this.i18n.setLanguage(n),this.toolbarRef?.refresh()}insertMedia(n,e,t,r,i){this.editor&&this.editor.commands.insertMedia({mediaId:n,resizeRule:e,align:t,zoomable:r,href:i})}insertLink(n,e){this.editor&&this.editor.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:e}}],text:n}).run()}async insertMediaFromGallery(n){if(n.kind==="file"){this.insertLink(n.originalName??n.url,n.url);return}if(n.kind==="image"){const e=this.service.themeConf.fTextImageResizeRules[0];if(!this.editor){this.service.logger.error("Editor not initialized");return}Kh(this.editor,{mediaId:n.mediaId,resizeRule:e,align:"center",zoomable:!0,href:void 0})}}handleContentClick(n){if(!this.editor)return;if(n.target.classList.contains("tiptap-content")){const t=this.editor.state.doc.content.size;this.editor.chain().focus().setTextSelection(t).run()}}render(){return z`
433
+ `,Cv=it.create({name:"textSize",addAttributes(){return{value:{default:null,parseHTML:n=>n.classList.contains("text-size-small")?"small":n.classList.contains("text-size-large")?"large":n.classList.contains("text-size-huge")?"huge":null,renderHTML:n=>n.value?{class:`text-size-${n.value}`}:{}}}},keepOnSplit:!1,parseHTML(){return[{tag:"span.text-size-small"},{tag:"span.text-size-large"},{tag:"span.text-size-huge"}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}});var Mv=Object.defineProperty,Av=Object.getOwnPropertyDescriptor,rn=(n,e,t,r)=>{for(var i=r>1?void 0:r?Av(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Mv(e,t,i),i};const Nv=t0.extend({content:"block*"}),_v=ma.extend({content:"block*"});let kt=class extends Yt{firstUpdated(){const t=`calc(${this.service.fieldType.adminUi?.editorRows??26}rem + 79px)`;this.style.setProperty("--content-height",t);const r=this.shadowRoot?.querySelector(".tiptap-content");if(!r)return;const i=this.service.configuration.code??!1;this.editor=new Oy({element:r,extensions:[Nv,rv,Uk.configure({document:!1,bulletList:!1,orderedList:!1,listItem:!1,heading:{levels:[2,3,4]},code:i?!1:void 0,codeBlock:i?!1:void 0,link:!1}),pa,ba,_v,uv.configure({openOnClick:!1,service:this.service,i18n:this.i18n}),k0.configure({types:["heading","paragraph"]}),rh,Cv,m0,b0,...this.service.configuration.code?[Vy,(()=>{const s=this.i18n;return e0.extend({addNodeView(){return({node:o,editor:a,getPos:l,decorations:c})=>new QE(o,a,l,c,s)}}).configure({lowlight:Hh,defaultLanguage:"plaintext",languageClassPrefix:"language-",HTMLAttributes:{class:"code-block"}})})()]:[],gv.configure({service:this.service,getLanguage:()=>this.service.language,i18n:this.i18n}),iv.configure({service:this.service,i18n:this.i18n}),vv.configure({service:this.service,i18n:this.i18n}),wv.configure({service:this.service,i18n:this.i18n,videoPluginHook:this.videoPluginHook}),ov.configure({service:this.service,i18n:this.i18n,internalLinkPluginHook:this.internalLinkPluginHook})],content:this.initialContent,editable:!0,editorProps:{handlePaste:(s,o)=>hv(s,o,this.editor,this.service,this.i18n,this.videoPluginHook),handleDrop:(s,o)=>fv(s,o,this.editor,this.service,this.i18n)},onCreate:({editor:s})=>{if(s.view.updateState(s.view.state),s.state.doc.content.size>0){const o=s.state.tr,a=H.create(o.doc,1);o.setSelection(a).setMeta("addToHistory",!1),s.view.dispatch(o)}},onUpdate:({editor:s,transaction:o})=>{this.onChange&&this.onChange(s.getJSON()),this.toolbarRef?.refresh(),this.videoPluginHook&&o.docChanged&&Sv(s,this.videoPluginHook)},onSelectionUpdate:()=>{this.toolbarRef?.refresh()}})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy()}setContent(n){this.editor?.commands.setContent(n)}getJSON(){return this.editor?.getJSON()}updateLanguage(n){this.i18n.setLanguage(n),this.toolbarRef?.refresh()}insertMedia(n,e,t,r,i){this.editor&&this.editor.commands.insertMedia({mediaId:n,resizeRule:e,align:t,zoomable:r,href:i})}insertLink(n,e){this.editor&&this.editor.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:e}}],text:n}).run()}async insertMediaFromGallery(n){if(n.kind==="file"){this.insertLink(n.originalName??n.url,n.url);return}if(n.kind==="image"){const e=this.service.themeConf.fTextImageResizeRules[0];if(!this.editor){this.service.logger.error("Editor not initialized");return}Kh(this.editor,{mediaId:n.mediaId,resizeRule:e,align:"center",zoomable:!0,href:void 0})}}handleContentClick(n){if(!this.editor)return;if(n.target.classList.contains("tiptap-content")){const t=this.editor.state.doc.content.size;this.editor.chain().focus().setTextSelection(t).run()}}render(){return z`
434
434
  <div class="tiptap-container">
435
435
  <tiptap-toolbar
436
436
  ${bE(n=>{this.toolbarRef=n})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/tiptap-editor-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Tiptap editor plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",