@ones-editor/editor 1.0.1 → 1.0.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.
package/dist/index.js CHANGED
@@ -712,7 +712,7 @@ ${s}
712
712
  <path d="M0 2.5L16 2.5" stroke="currentColor"/>
713
713
  <path d="M0 13.5L16 13.5" stroke="currentColor"/>
714
714
  </svg>
715
- `,Ust="";I("file-box");function Rw(n,t){const e=n.getBoxData(t),r=n.options.componentsOptions.file;if(r!=null&&r.onDownloadFile){r.onDownloadFile(n,e,"box");return}const i=n.doc.buildResourceUrl(e.src,{downloadFileName:e.fileName});Td(i,e.fileName)}class lW{constructor(t){g(this,"group","file-box-commands");g(this,"_commands",[{id:"download",name:D.t("file.commands.download"),icon:BE},{id:"add-comment",name:D.t("file.commands.comment"),icon:Js},{id:"sep",name:"",type:"separator"},{id:"to-link",name:D.t("file.commands.toLink"),icon:yw,states:["checked"]},{id:"to-card",name:D.t("file.commands.toCard"),icon:kw}]);this.editor=t}get commands(){if(!this.editor.readonly){const{enableComments:e=!0}=this.editor.options;return e?this._commands:this._commands.filter(r=>r.id!=="add-comment")}const t=this._commands.filter(e=>e.id!=="to-link"&&e.id!=="to-card");return t[t.length-1].id==="sep"&&t.pop(),t}executeCommand(t,e,r,i){if(i.id==="to-card"){const o=it(e),s=ft(o),l=bt(e)+1,c=t.getBoxData(r),d=js(e,r);t.undoManager.runInGroup(()=>{const h={src:c.src,previewType:Tw.Card,fileName:c.fileName,fileSize:c.fileSize,fileType:c.fileType};d.start===0?dt(t,e)===1?(t.deleteBlock(e),t.insertEmbed(s,l-1,"office",h)):(t.deleteTextFromBlock(e,d.start,1),t.insertEmbed(s,l-1,"office",h)):d.start===dt(t,e)-1?(t.deleteTextFromBlock(e,d.start,1),t.insertEmbed(s,l,"office",h)):(t.deleteTextFromBlock(e,d.start,1),ma(t,e,d.start,{forceInsertAfter:!0}),t.insertEmbed(s,l,"office",h))})}else i.id==="download"?Rw(t,r):i.id==="add-comment"&&lf(t,e)}}function aW(n,t,e,r){const i=r,o=B("a",["file-container"],e),s=B("span",["file-icon"],o);s.innerHTML=sW,B("span",["file-name"],o,i.fileName),o.setAttribute("data-file-id",i.id),o.setAttribute("data-file-src",i.src)}function cW(n,t,e){const r=n.options.componentsOptions.file;if(r!=null&&r.onClick){r.onClick(n,t,e);return}Rw(n,t)}function uW(n,t){return{boxCommands:{"hovering-toolbar":new lW(n)},abstract:D.t("file.abstract")}}function fW(n,t,e,r){const i=t;return r==="html"?i.src?`<a href="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" >${i.fileName}</a>`:`[${i.fileName}]`:r==="markdown"?i.src?`![${i.fileName}](${n.doc.buildResourceUrl(i.src,{withToken:!0})})`:`[${i.fileName}]`:i.fileName}async function dW(n,t){const e=t,{fileName:r,src:i}=e,{onGetFileDownloadUrl:o}=n.getComponentOptions("file")||{},s=o?await o(n,e):void 0;return[{insert:r,attributes:{link:s||i}}]}const ww={boxType:"file",updateBoxContent:aW,handleClickBox:cW,getBoxProperties:uW,convertTo:fW,toStandardText:dW},hW=`<svg width="48" height="48" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
715
+ `,Ust="";I("file-box");function Rw(n,t){const e=n.getBoxData(t),r=n.options.componentsOptions.file;if(r!=null&&r.onDownloadFile){r.onDownloadFile(n,e,"box");return}const i=n.doc.buildResourceUrl(e.src,{downloadFileName:e.fileName});Td(i,e.fileName)}class lW{constructor(t){g(this,"group","file-box-commands");g(this,"_commands",[{id:"download",name:D.t("file.commands.download"),icon:BE},{id:"add-comment",name:D.t("file.commands.comment"),icon:Js},{id:"sep",name:"",type:"separator"},{id:"to-link",name:D.t("file.commands.toLink"),icon:yw,states:["checked"]},{id:"to-card",name:D.t("file.commands.toCard"),icon:kw}]);this.editor=t}get commands(){if(!this.editor.readonly){const{enableComments:e=!0}=this.editor.options;return e?this._commands:this._commands.filter(r=>r.id!=="add-comment")}const t=this._commands.filter(e=>e.id!=="to-link"&&e.id!=="to-card"&&e.id!=="add-comment");return t[t.length-1].id==="sep"&&t.pop(),t}executeCommand(t,e,r,i){if(i.id==="to-card"){const o=it(e),s=ft(o),l=bt(e)+1,c=t.getBoxData(r),d=js(e,r);t.undoManager.runInGroup(()=>{const h={src:c.src,previewType:Tw.Card,fileName:c.fileName,fileSize:c.fileSize,fileType:c.fileType};d.start===0?dt(t,e)===1?(t.deleteBlock(e),t.insertEmbed(s,l-1,"office",h)):(t.deleteTextFromBlock(e,d.start,1),t.insertEmbed(s,l-1,"office",h)):d.start===dt(t,e)-1?(t.deleteTextFromBlock(e,d.start,1),t.insertEmbed(s,l,"office",h)):(t.deleteTextFromBlock(e,d.start,1),ma(t,e,d.start,{forceInsertAfter:!0}),t.insertEmbed(s,l,"office",h))})}else i.id==="download"?Rw(t,r):i.id==="add-comment"&&lf(t,e)}}function aW(n,t,e,r){const i=r,o=B("a",["file-container"],e),s=B("span",["file-icon"],o);s.innerHTML=sW,B("span",["file-name"],o,i.fileName),o.setAttribute("data-file-id",i.id),o.setAttribute("data-file-src",i.src)}function cW(n,t,e){const r=n.options.componentsOptions.file;if(r!=null&&r.onClick){r.onClick(n,t,e);return}Rw(n,t)}function uW(n,t){return{boxCommands:{"hovering-toolbar":new lW(n)},abstract:D.t("file.abstract")}}function fW(n,t,e,r){const i=t;return r==="html"?i.src?`<a href="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" >${i.fileName}</a>`:`[${i.fileName}]`:r==="markdown"?i.src?`![${i.fileName}](${n.doc.buildResourceUrl(i.src,{withToken:!0})})`:`[${i.fileName}]`:i.fileName}async function dW(n,t){const e=t,{fileName:r,src:i}=e,{onGetFileDownloadUrl:o}=n.getComponentOptions("file")||{},s=o?await o(n,e):void 0;return[{insert:r,attributes:{link:s||i}}]}const ww={boxType:"file",updateBoxContent:aW,handleClickBox:cW,getBoxProperties:uW,convertTo:fW,toStandardText:dW},hW=`<svg width="48" height="48" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
716
716
  <path d="M12 1C13.5 2.5 14 3 16 5V15.6087C16 15.7914 15.9638 15.9723 15.8934 16.1411C15.8231 16.3099 15.7199 16.4633 15.5899 16.5925C15.4599 16.7217 15.3056 16.8242 15.1358 16.8941C14.9659 16.964 14.7838 17 14.6 17H3.4C3.21615 17 3.0341 16.964 2.86424 16.8941C2.69439 16.8242 2.54005 16.7217 2.41005 16.5925C2.28005 16.4633 2.17693 16.3099 2.10657 16.1411C2.03621 15.9723 2 15.7914 2 15.6087V2.3913C2 2.2086 2.03621 2.02768 2.10657 1.85888C2.17693 1.69007 2.28005 1.5367 2.41005 1.4075C2.54005 1.27831 2.69439 1.17583 2.86424 1.10591C3.0341 1.03599 3.21615 1 3.4 1H12Z" fill="#FFBE5A"/>
717
717
  <path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 7.5V11.1H8.7C9.69411 11.1 10.5 10.2941 10.5 9.3C10.5 8.30589 9.69411 7.5 8.7 7.5H7.5ZM7 6C6.44772 6 6 6.44771 6 7V11.6C6 12.1523 6.44772 12.6 7 12.6H8.7C10.5225 12.6 12 11.1225 12 9.3C12 7.47746 10.5225 6 8.7 6H7Z" fill="white"/>
718
718
  <path d="M12 1L14 3L16 5H13.3333C12.9797 5 12.6406 4.84675 12.3905 4.57397C12.1405 4.30119 12 3.93122 12 3.54546V1Z" fill="#FFD89C"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",