@remarkablejames/editor 0.0.3 → 0.0.5
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/lib/{ActionMenuButton-DN6VHLkp.cjs → ActionMenuButton-C6jGtl3k.cjs} +1 -1
- package/lib/{ActionMenuButton-D5HLfRzv.js → ActionMenuButton-DBZjUu-F.js} +1 -1
- package/lib/Attachment.cjs +1 -19
- package/lib/Attachment.js +6 -270
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +4 -4
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +3 -3
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-BN0lYcnJ.cjs → Drawer-B031ezmA.cjs} +2 -2
- package/lib/{Drawer-B9l1SoRJ.js → Drawer-DTCwtJEs.js} +27 -27
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +6 -6
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +11 -12
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +1 -1
- package/lib/History.js +3 -3
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/Iframe-BUK2pkOL.cjs +1 -0
- package/lib/{Iframe-MjeJ2OOI.js → Iframe-D-UYBxiv.js} +8 -9
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +2 -2
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +15 -15
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +3 -3
- package/lib/{Indent-CgwDItIf.js → Indent-Bvt-Qwar.js} +2 -2
- package/lib/{Indent-BPX9XRos.cjs → Indent-_y6N8MIQ.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-CZ4g3vA9.js → Katex-CJDtvu-v.js} +63 -63
- package/lib/Katex-bJXkt-VP.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-CaDV3Vq5.js → LinkEditBlock-Cdqwj_NU.js} +4 -4
- package/lib/{LinkEditBlock-B2bU0Mcr.cjs → LinkEditBlock-ewTApx0K.cjs} +1 -1
- package/lib/Mention.js +3 -3
- package/lib/{Mermaid-EhYj_ICn.js → Mermaid-CnMYVX1P.js} +3 -3
- package/lib/{Mermaid-B9h7XKFo.cjs → Mermaid-Dwz9o-yM.cjs} +1 -1
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +3 -3
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +1 -0
- package/lib/{SlashCommandNodeView-CY3peX5x.js → SlashCommandNodeView-DcoLvt_6.js} +78 -88
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-DLrtX6T7.cjs → Table-B8CHl8jK.cjs} +1 -1
- package/lib/{Table-Bw7rLue7.js → Table-Cu12PvQ_.js} +5 -5
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-Ck6vGefg.cjs → Twitter-6HYP_upt.cjs} +1 -1
- package/lib/{Twitter-pM0y5Z-L.js → Twitter-CrX4XY1j.js} +4 -4
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +4 -4
- package/lib/bubble.cjs +1 -1
- package/lib/bubble.js +19 -19
- package/lib/{clsx-CDyrfCnw.js → clsx-BUPZHhq3.js} +2 -2
- package/lib/components/SlashDialogTrigger/RenderDialogUploadAttachment.d.ts +1 -0
- package/lib/{dropdown-menu-nX-u8e2w.js → dropdown-menu-CVwXaR3Z.js} +1 -1
- package/lib/{dropdown-menu-DwR8tTs9.cjs → dropdown-menu-XIrQk3jr.cjs} +1 -1
- package/lib/extensions/Attachment/Attachment.d.ts +34 -3
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
- package/lib/{index-_WrFM-Fk.js → index-B0d-u29p.js} +1529 -1158
- package/lib/{index-4Q5IhypJ.js → index-BGd2HiwP.js} +48 -12
- package/lib/{index-CsSfYR30.js → index-D4M4hrH4.js} +1 -1
- package/lib/{index-DjDf4BK8.js → index-DZj2z9_1.js} +1 -1
- package/lib/index-De9MZVWQ.cjs +28 -0
- package/lib/index-DgOXAdKt.cjs +1 -0
- package/lib/{index-C1WCZhyA.js → index-Dl3OjzmR.js} +1 -1
- package/lib/{index-C-tDsIKJ.js → index-RkKGy5oa.js} +1 -1
- package/lib/index.cjs +3 -3
- package/lib/index.js +13 -13
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/en.d.ts +194 -188
- package/lib/locales/fi.d.ts +194 -188
- package/lib/locales/hu.d.ts +194 -188
- package/lib/locales/index.d.ts +1164 -1128
- package/lib/locales/pt-br.d.ts +194 -188
- package/lib/locales/vi.d.ts +194 -188
- package/lib/locales/zh-cn.d.ts +194 -188
- package/lib/{popover-BY7j9SiD.cjs → popover-0syCfWYi.cjs} +1 -1
- package/lib/{popover-CSvY4C-l.js → popover-DDT8YRht.js} +1 -1
- package/lib/{renderNodeView-BJSrgyGj.js → renderNodeView-dj6AaFSX.js} +2 -2
- package/lib/{select-BelNLNvT.js → select-D9wQw2qB.js} +1 -1
- package/lib/{select-Bu-5iIA9.cjs → select-DTNz0ZeE.cjs} +1 -1
- package/lib/{separator-Cp9Lg3HU.cjs → separator-D8lOAf8f.cjs} +1 -1
- package/lib/{separator-Br5kcIJa.js → separator-DRGTEiX4.js} +3 -3
- package/lib/style.css +1 -1
- package/lib/{textarea-Ceev4t42.js → textarea-DfVzbMr5.js} +1 -1
- package/lib/{textarea-DfqvYaA6.cjs → textarea-DpkwluT0.cjs} +1 -1
- package/lib/{updatePosition-e90ZrFWW.js → updatePosition-C294Pixi.js} +2 -2
- package/lib/utils/customEvents/events.constant.d.ts +1 -0
- package/package.json +1 -1
- package/lib/Iframe-CXFk3GEq.cjs +0 -1
- package/lib/Katex-DIgsR_dS.cjs +0 -4
- package/lib/SlashCommandNodeView-COlWSlnE.cjs +0 -1
- package/lib/dom-dataset-BqoJhJXt.cjs +0 -1
- package/lib/dom-dataset-CIEeltF6.js +0 -47
- package/lib/index-Dib4cXXf.cjs +0 -10
- package/lib/index-bVGIXhRg.cjs +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-
|
|
1
|
+
import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
import { Resizable as M } from "re-resizable";
|
|
4
4
|
import { useState as R, useCallback as N } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { w as j, j as U, B as q, u as A, d as L, A as D } from "./index-_WrFM-Fk.js";
|
|
5
|
+
import { w as j, j as U, B as q, u as A, d as L, A as D, F as l } from "./index-B0d-u29p.js";
|
|
7
6
|
import "./theme.js";
|
|
8
7
|
const m = {
|
|
9
8
|
youtube: {
|
|
@@ -168,10 +167,10 @@ function X(e) {
|
|
|
168
167
|
function J(e, t) {
|
|
169
168
|
return t.src = `${t.matchedUrl}?background=white&banner=show&embedded=true`, t.validId = !0, t.originalLink = e, t;
|
|
170
169
|
}
|
|
171
|
-
function
|
|
170
|
+
function F(e, t) {
|
|
172
171
|
return t.src = `${t.matchedUrl}`, t.validId = !0, t.originalLink = e, t;
|
|
173
172
|
}
|
|
174
|
-
function
|
|
173
|
+
function W(e, t, i) {
|
|
175
174
|
if (e === "googlemaps")
|
|
176
175
|
return i.validLink = !0, i.matchedUrl = t, i;
|
|
177
176
|
const n = m[e].linkRule;
|
|
@@ -196,7 +195,7 @@ function Z(e) {
|
|
|
196
195
|
src: ""
|
|
197
196
|
};
|
|
198
197
|
const i = G(e);
|
|
199
|
-
if (t =
|
|
198
|
+
if (t = W(i, e, t), !t.validLink)
|
|
200
199
|
return t;
|
|
201
200
|
switch (i) {
|
|
202
201
|
case "youtube":
|
|
@@ -228,7 +227,7 @@ function Z(e) {
|
|
|
228
227
|
case "jinshuju":
|
|
229
228
|
return J(e, t);
|
|
230
229
|
case "iframe":
|
|
231
|
-
return
|
|
230
|
+
return F(e, t);
|
|
232
231
|
default:
|
|
233
232
|
return e;
|
|
234
233
|
}
|
|
@@ -293,7 +292,7 @@ function te({ editor: e, node: t, updateAttributes: i }) {
|
|
|
293
292
|
)
|
|
294
293
|
] });
|
|
295
294
|
}
|
|
296
|
-
function
|
|
295
|
+
function me() {
|
|
297
296
|
const e = A(b.name), {
|
|
298
297
|
icon: t = void 0,
|
|
299
298
|
tooltip: i = void 0,
|
|
@@ -411,6 +410,6 @@ const b = /* @__PURE__ */ k.create({
|
|
|
411
410
|
});
|
|
412
411
|
export {
|
|
413
412
|
b as I,
|
|
414
|
-
|
|
413
|
+
me as R,
|
|
415
414
|
Z as g
|
|
416
415
|
};
|
package/lib/Iframe.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-BUK2pkOL.cjs");require("./index-De9MZVWQ.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
|
package/lib/Iframe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./clsx-
|
|
2
|
-
import { I as o, R as t } from "./Iframe-
|
|
3
|
-
import "./
|
|
1
|
+
import "./clsx-BUPZHhq3.js";
|
|
2
|
+
import { I as o, R as t } from "./Iframe-D-UYBxiv.js";
|
|
3
|
+
import "./index-B0d-u29p.js";
|
|
4
4
|
export {
|
|
5
5
|
o as Iframe,
|
|
6
6
|
t as RichTextIframe
|
package/lib/Image.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-De9MZVWQ.cjs");exports.Image=e.Image;exports.RichTextImage=e.RichTextImage;
|
package/lib/Image.js
CHANGED
package/lib/ImageGif.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./clsx-CXbNJWDD.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./clsx-CXbNJWDD.cjs"),f=require("./index-De9MZVWQ.cjs"),l=require("react/jsx-runtime"),u=require("react"),j=require("./index-DgOXAdKt.cjs");require("./theme.cjs");const L=require("./popover-0syCfWYi.cjs"),N={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function q(e){var k,z;const[t,r]=u.useState({width:j.IMAGE_MAX_SIZE,height:j.IMAGE_MAX_SIZE}),[o,i]=u.useState({width:0,height:0}),[n]=u.useState([N.TOP_LEFT,N.TOP_RIGHT,N.BOTTOM_LEFT,N.BOTTOM_RIGHT]),[s,a]=u.useState(!1),[h,x]=u.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=(k=e==null?void 0:e.node)==null?void 0:k.attrs,m=u.useMemo(()=>{var b;const{src:c,alt:w,width:v,height:A}=(b=e==null?void 0:e.node)==null?void 0:b.attrs,G=f.isNumber(v)?`${v}px`:v,d=f.isNumber(A)?`${A}px`:A;return{src:c||void 0,alt:w||void 0,style:{width:G||void 0,height:d||void 0}}},[(z=e==null?void 0:e.node)==null?void 0:z.attrs]),_=u.useMemo(()=>{const{style:{width:c}}=m;return{width:c==="100%"?c:void 0}},[m]);function g(c){i({width:c.target.width,height:c.target.height})}function I(){const{editor:c,getPos:w}=e;c.commands.setNodeSelection(w())}const M=u.useCallback(f.throttle(()=>{const{editor:c}=e,{width:w}=getComputedStyle(c.view.dom);r(v=>({...v,width:Number.parseInt(w,10)}))},j.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function H(c,w){c.preventDefault(),c.stopPropagation();const v=o.width,A=o.height,G=v/A;let d=Number(e.node.attrs.width),b=Number(e.node.attrs.height);const y=t.width;d&&!b?(d=d>y?y:d,b=Math.round(d/G)):b&&!d?(d=Math.round(b*G),d=d>y?y:d):!d&&!b?(d=v>y?y:v,b=Math.round(d/G)):d=d>y?y:d,a(!0),x({x:c.clientX,y:c.clientY,w:d,h:b,dir:w})}const E=u.useCallback(f.throttle(c=>{if(c.preventDefault(),c.stopPropagation(),!s)return;const{x:w,w:v,dir:A}=h,G=(c.clientX-w)*(/l/.test(A)?-1:1),d=f.clamp$1(v+G,j.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:d,height:null})},j.IMAGE_THROTTLE_WAIT_TIME),[s,h,t,e.updateAttributes]),S=u.useCallback(c=>{c.preventDefault(),c.stopPropagation(),s&&(x({x:0,y:0,w:0,h:0,dir:""}),a(!1),I())},[s,I]),$=u.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",S,!0)},[E,S]),O=u.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",S,!0)},[E,S]);u.useEffect(()=>(s?$():O(),()=>{O()}),[s,$,O]);const R=u.useMemo(()=>new ResizeObserver(()=>M()),[M]);return u.useEffect(()=>(R.observe(e.editor.view.dom),()=>{R.disconnect()}),[e.editor.view.dom,R]),l.jsx(P.NodeViewWrapper,{className:"image-view",style:{..._,width:"100%",textAlign:T},children:l.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:_,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[l.jsx("img",{alt:m.alt,className:"image-view__body__image block",height:"auto",onClick:I,onLoad:g,src:m.src,style:m.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&l.jsx("div",{className:"image-resizer",children:n==null?void 0:n.map(c=>l.jsx("span",{className:`image-resizer__handler image-resizer__handler--${c}`,onMouseDown:w=>H(w,c)},`image-dir-${c}`))})]})})}async function W(e){var o;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(o=r==null?void 0:r.data)==null?void 0:o.map(i=>{var n,s,a;return{id:i==null?void 0:i.id,src:(n=i==null?void 0:i.images.original)==null?void 0:n.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function p(e,t){var i;const o=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=o==null?void 0:o.data)==null?void 0:i.map(n=>{var s,a,h;return{id:n==null?void 0:n.id,src:(s=n==null?void 0:n.images.original)==null?void 0:s.url,width:+((a=n==null?void 0:n.images.original)==null?void 0:a.width),height:+((h=n==null?void 0:n.images.original)==null?void 0:h.width)}})}async function D(e){var n,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(n=r==null?void 0:r.results)==null?void 0:n[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var h,x,T,m,_,g,I,M;return{id:a==null?void 0:a.id,src:(x=(h=a==null?void 0:a.media_formats)==null?void 0:h.gif)==null?void 0:x.url,width:(_=(m=(T=a==null?void 0:a.media_formats)==null?void 0:T.gif)==null?void 0:m.dims)==null?void 0:_[0],height:(M=(I=(g=a==null?void 0:a.media_formats)==null?void 0:g.gif)==null?void 0:I.dims)==null?void 0:M[1]}})}async function F(e,t){var i;const o=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=o==null?void 0:o.results)==null?void 0:i.map(n=>{var s,a,h,x,T,m,_,g;return{id:n==null?void 0:n.id,src:(a=(s=n==null?void 0:n.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(T=(x=(h=n==null?void 0:n.media_formats)==null?void 0:h.gif)==null?void 0:x.dims)==null?void 0:T[0],height:(g=(_=(m=n==null?void 0:n.media_formats)==null?void 0:m.gif)==null?void 0:_.dims)==null?void 0:g[1]}})}function B(e,t){return{searchTrending:async()=>t?e==="giphy"?W(t):e==="tenor"?D(t):[]:[],searchWord:async i=>t?e==="giphy"?p(i,t):e==="tenor"?F(i,t):[]:[]}}function V({selectImage:e,apiKey:t,provider:r,children:o}){const[i,n]=u.useState(!1),[s,a]=u.useState([]),{editorDisabled:h}=f.useToggleActive(),x=u.useRef(null),{searchTrending:T,searchWord:m}=B(r,t);u.useEffect(()=>{(async()=>{const g=await T();a(g)})()},[]);const _=u.useCallback(f.debounce(async g=>{if(!g.target.value){const M=await T();a(M);return}const I=await m(g.target.value);a(I)},350),[]);return l.jsxs(L.Popover,{modal:!0,onOpenChange:n,open:i,children:[l.jsx(L.PopoverTrigger,{asChild:!0,disabled:h,children:o}),l.jsx(L.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:l.jsx(f.Input,{onChange:_,placeholder:"Search GIF",ref:x,type:"text"})}),l.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:l.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1",children:s!=null&&s.length?s==null?void 0:s.map(g=>l.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",src:g.src,onClick:()=>{e(g.src),n(!1)}},g.id)):l.jsx("p",{children:"No GIFs found"})})})]}):l.jsx("div",{children:l.jsx("p",{children:"Missing Giphy API Key"})})})]})}function X(){const e=f.useButtonProps(C.name),{action:t,icon:r,tooltip:o,apiKey:i,provider:n}=(e==null?void 0:e.componentProps)??{},{editorDisabled:s}=f.useToggleActive(),a=h=>{s||t&&t(h)};return l.jsx(V,{apiKey:i,provider:n,selectImage:a,children:l.jsx(f.ActionButton,{disabled:s,icon:r,tooltip:o})})}const C=f.index_default.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:o})=>{var s,a;const i=((s=r==null?void 0:r.options)==null?void 0:s.provider)||"",n=((a=r==null?void 0:r.options)==null?void 0:a.API_KEY)||"";return{componentProps:{action:h=>{t.chain().focus().setImageGif({src:h}).run()},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:o("editor.imageGif.tooltip"),apiKey:n,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return P.ReactNodeViewRenderer(q)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",P.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.ImageGif=C;exports.RichTextImageGif=X;
|
package/lib/ImageGif.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { h as B, m as q, k as V } from "./clsx-
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as u, jsxs as
|
|
4
|
-
import { useState as G, useMemo as
|
|
5
|
-
import { I as j, i as W, j as te } from "./index-
|
|
1
|
+
import { h as B, m as q, k as V } from "./clsx-BUPZHhq3.js";
|
|
2
|
+
import { G as k, H as C, J as X, u as Y, d as D, A as Z, K as J, j as U, M as Q } from "./index-B0d-u29p.js";
|
|
3
|
+
import { jsx as u, jsxs as z, Fragment as K } from "react/jsx-runtime";
|
|
4
|
+
import { useState as G, useMemo as P, useCallback as M, useEffect as $, useRef as ee } from "react";
|
|
5
|
+
import { I as j, i as W, j as te } from "./index-BGd2HiwP.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { P as ne, a as re, b as ie } from "./popover-
|
|
7
|
+
import { P as ne, a as re, b as ie } from "./popover-DDT8YRht.js";
|
|
8
8
|
const O = {
|
|
9
9
|
TOP_LEFT: "tl",
|
|
10
10
|
TOP_RIGHT: "tr",
|
|
@@ -30,7 +30,7 @@ function ae(e) {
|
|
|
30
30
|
w: 0,
|
|
31
31
|
h: 0,
|
|
32
32
|
dir: ""
|
|
33
|
-
}), { align: b } = (p = e == null ? void 0 : e.node) == null ? void 0 : p.attrs, g =
|
|
33
|
+
}), { align: b } = (p = e == null ? void 0 : e.node) == null ? void 0 : p.attrs, g = P(() => {
|
|
34
34
|
var w;
|
|
35
35
|
const { src: o, alt: m, width: f, height: x } = (w = e == null ? void 0 : e.node) == null ? void 0 : w.attrs, A = k(f) ? `${f}px` : f, d = k(x) ? `${x}px` : x;
|
|
36
36
|
return {
|
|
@@ -41,7 +41,7 @@ function ae(e) {
|
|
|
41
41
|
height: d || void 0
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
}, [(H = e == null ? void 0 : e.node) == null ? void 0 : H.attrs]), _ =
|
|
44
|
+
}, [(H = e == null ? void 0 : e.node) == null ? void 0 : H.attrs]), _ = P(() => {
|
|
45
45
|
const {
|
|
46
46
|
style: { width: o }
|
|
47
47
|
} = g;
|
|
@@ -110,15 +110,15 @@ function ae(e) {
|
|
|
110
110
|
$(() => (a ? R() : S(), () => {
|
|
111
111
|
S();
|
|
112
112
|
}), [a, R, S]);
|
|
113
|
-
const
|
|
114
|
-
return $(() => (
|
|
115
|
-
|
|
116
|
-
}), [e.editor.view.dom,
|
|
113
|
+
const L = P(() => new ResizeObserver(() => I()), [I]);
|
|
114
|
+
return $(() => (L.observe(e.editor.view.dom), () => {
|
|
115
|
+
L.disconnect();
|
|
116
|
+
}), [e.editor.view.dom, L]), /* @__PURE__ */ u(
|
|
117
117
|
B,
|
|
118
118
|
{
|
|
119
119
|
className: "image-view",
|
|
120
120
|
style: { ..._, width: "100%", textAlign: b },
|
|
121
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ z(
|
|
122
122
|
"div",
|
|
123
123
|
{
|
|
124
124
|
"data-drag-handle": !0,
|
|
@@ -239,7 +239,7 @@ function he({ selectImage: e, apiKey: t, provider: r, children: c }) {
|
|
|
239
239
|
// Adjust the debounce delay as needed
|
|
240
240
|
[]
|
|
241
241
|
);
|
|
242
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ z(ne, { modal: !0, onOpenChange: n, open: i, children: [
|
|
243
243
|
/* @__PURE__ */ u(re, { asChild: !0, disabled: l, children: c }),
|
|
244
244
|
/* @__PURE__ */ u(
|
|
245
245
|
ie,
|
|
@@ -248,7 +248,7 @@ function he({ selectImage: e, apiKey: t, provider: r, children: c }) {
|
|
|
248
248
|
className: "richtext-size-full richtext-p-2",
|
|
249
249
|
hideWhenDetached: !0,
|
|
250
250
|
side: "bottom",
|
|
251
|
-
children: t ? /* @__PURE__ */
|
|
251
|
+
children: t ? /* @__PURE__ */ z(K, { children: [
|
|
252
252
|
/* @__PURE__ */ u("div", { className: "richtext-mb-[10px] richtext-w-full", children: /* @__PURE__ */ u(
|
|
253
253
|
U,
|
|
254
254
|
{
|
package/lib/ImportWord.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./clsx-CXbNJWDD.cjs"),u=require("react/jsx-runtime"),H=require("mammoth"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./clsx-CXbNJWDD.cjs"),u=require("react/jsx-runtime"),H=require("mammoth"),T=require("react"),s=require("./index-De9MZVWQ.cjs");require("./theme.cjs");const P=require("./index-DgOXAdKt.cjs");function N(o,t){const a=atob(o.split(",")[1]),l=Array.from({length:a.length});for(let i=0;i<a.length;i++)l[i]=a.charCodeAt(i);const m=new Uint8Array(l);return new Blob([m],{type:t})}function k(o,t){return new File([o],t,{type:o.type})}function z(){const o=s.useEditorInstance(),t=s.useButtonProps(y.name),{icon:a=void 0,tooltip:l=void 0,tooltipOptions:m={},isActive:i=void 0,mammothOptions:w,limit:j,convert:b}=(t==null?void 0:t.componentProps)??{},{editorDisabled:W}=s.useToggleActive(i),p=s.useExtension(y.name),{toast:q}=s.useToast(),{t:S}=P.useLocale(),[C,v]=T.useState(!1),x=T.useRef(null);function O(){var e;(e=x.current)==null||e.click()}function R(e){const n=e.target.files[0];if(n){if(n.size>j){q({variant:"destructive",title:S("editor.importWord.limitSize")});return}E(n)}}async function B(e){const c=new DOMParser().parseFromString(e,"text/html"),f=c.querySelectorAll("img");if(f.length===0)return c.body.innerHTML;if(s.hasExtension(o,s.Image.name)){const g=p==null?void 0:p.options;if(g&&typeof g.upload=="function"){const A=[];for(const h of f){const d=h.getAttribute("src"),r=N(d,"image/jpeg"),L=k(r,"image.jpeg");A.push(L)}const F=await g.upload(A);for(const[h,d]of f.entries()){d.setAttribute("src",F[h].src);const r=d.parentElement;(r==null?void 0:r.tagName)==="P"&&(r.insertAdjacentElement("beforebegin",d),!r.hasChildNodes()&&r.textContent===""&&r.remove())}return c.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),c.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),c.body.innerHTML}async function E(e){v(!0);try{if(b){const n=await b(e);I(n)}else{const n=await e.arrayBuffer(),{value:c}=await H.convertToHtml({arrayBuffer:n},w);I(c)}}finally{v(!1)}}async function I(e){const n=await B(e);o.chain().setContent(n,!0).run()}return t?u.jsxs(u.Fragment,{children:[u.jsx(s.ActionButton,{action:O,disabled:W,icon:a,loading:C,tooltip:l,tooltipOptions:m}),u.jsx("input",{accept:".docx",onChange:R,ref:x,type:"file",style:{display:"none"}})]}):u.jsx(u.Fragment,{})}const y=M.Extension.create({name:"importWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({extension:t,t:a})=>{const{convert:l,limit:m,mammothOptions:i}=t.options;return{componentProps:{convert:l,limit:m,mammothOptions:i,icon:"Word",shortcutKeys:t.options.shortcutKeys??["alt","mod","S"],tooltip:a("editor.importWord.tooltip")}}}}}});exports.ImportWord=y;exports.RichTextImportWord=z;
|
package/lib/ImportWord.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as M } from "./clsx-
|
|
1
|
+
import { E as M } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsx as g, Fragment as I, jsxs as P } from "react/jsx-runtime";
|
|
3
3
|
import R from "mammoth";
|
|
4
4
|
import { useState as N, useRef as k } from "react";
|
|
5
|
-
import { h as q, u as z, d as D, q as K, r as U, A as G, s as J, t as Q } from "./index-
|
|
5
|
+
import { h as q, u as z, d as D, q as K, r as U, A as G, s as J, t as Q } from "./index-B0d-u29p.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { u as V } from "./index-
|
|
7
|
+
import { u as V } from "./index-BGd2HiwP.js";
|
|
8
8
|
function X(e, t) {
|
|
9
9
|
const s = atob(e.split(",")[1]), c = Array.from({ length: s.length });
|
|
10
10
|
for (let i = 0; i < s.length; i++)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as y, E as x } from "./clsx-
|
|
1
|
+
import { s as y, E as x } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { TextSelection as b, AllSelection as I } from "@tiptap/pm/state";
|
|
3
3
|
import { jsx as d, Fragment as m, jsxs as A } from "react/jsx-runtime";
|
|
4
|
-
import { u as T, d as K, A as p } from "./index-
|
|
4
|
+
import { u as T, d as K, A as p } from "./index-B0d-u29p.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
var a = /* @__PURE__ */ ((t) => (t[t.max = 7] = "max", t[t.min = 0] = "min", t[t.more = 1] = "more", t[t.less = -1] = "less", t))(a || {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";const p=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),u=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");var a=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(a||{});function b(t,e,n){return t<e?e:t>n?n:t}function A(t,e,n,o){const{doc:s,selection:r}=t;if(!s||!r||!(r instanceof l.TextSelection||r instanceof l.AllSelection))return t;const{from:i,to:d}=r;return s.nodesBetween(i,d,(m,x)=>{const I=m.type;return n.includes(I.name)?(t=h(t,x,e),!1):!p.isList(m.type.name,o.extensionManager.extensions)}),t}function h(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o)return t;const i=b((o.attrs.indent||0)+n,0,7);if(i===o.attrs.indent)return t;const d={...o.attrs,indent:i};return t.setNodeMarkup(e,o.type,d,o.marks)}function f({delta:t,types:e}){return({state:n,dispatch:o,editor:s})=>{const{selection:r}=n;let{tr:i}=n;return i=i.setSelection(r),i=A(i,t,e,s),i.docChanged?(o&&o(i),!0):!1}}function T(){const t=u.useButtonProps(y.name),{indent:e,outdent:n}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o}=u.useToggleActive(),s=()=>{o||e!=null&&e.action&&(e==null||e.action())},r=()=>{o||n!=null&&n.action&&(n==null||n.action())};return t?c.jsxs(c.Fragment,{children:[c.jsx(u.ActionButton,{action:s,disabled:o,icon:e==null?void 0:e.icon,shortcutKeys:e==null?void 0:e.shortcutKeys,tooltip:e==null?void 0:e.tooltip}),c.jsx(u.ActionButton,{action:r,disabled:o,icon:n==null?void 0:n.icon,shortcutKeys:n==null?void 0:n.shortcutKeys,tooltip:n==null?void 0:n.tooltip})]}):c.jsx(c.Fragment,{})}const y=p.Extension.create({name:"richtextIndentOutdent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:a.min,maxIndent:a.max,button({editor:e,t:n,extension:o}){var s,r;return{componentProps:{indent:{action:()=>{e.commands.indent()},shortcutKeys:((s=o.options.shortcutKeys)==null?void 0:s[0])??["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")},outdent:{action:()=>{e.commands.outdent()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[1])??["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.dataset.indent;return(e?Number.parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>f({delta:a.more,types:this.options.types}),outdent:()=>f({delta:a.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});exports.Indent=y;exports.IndentProps=a;exports.RichTextIndent=T;exports.setNodeIndentMarkup=h;
|
package/lib/Indent.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Indent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Indent-_y6N8MIQ.cjs");exports.Indent=e.Indent;exports.RichTextIndent=e.RichTextIndent;
|
package/lib/Indent.js
CHANGED
package/lib/Italic.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),a=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,I=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,h=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,v=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,f=r.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r.markInputRule({find:y,type:this.type}),r.markInputRule({find:h,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:I,type:this.type}),r.markPasteRule({find:v,type:this.type})]}}),k=f;function M(){const t=a.useButtonProps(u.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:i=void 0,tooltipOptions:l={},action:o=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:m,disabled:c,update:p}=a.useToggleActive(d),g=()=>{c||o&&(o(),p())};return t?s.jsx(a.ActionButton,{action:g,dataState:m,disabled:c,icon:e,shortcutKeys:i,tooltip:n,tooltipOptions:l}):s.jsx(s.Fragment,{})}const u=k.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n,extension:i}){return{componentProps:{action:()=>e.commands.toggleItalic(),isActive:()=>e.isActive("italic")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}});exports.Italic=u;exports.RichTextItalic=M;
|
package/lib/Italic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as g, e as i, f as o, m as y } from "./clsx-
|
|
1
|
+
import { M as g, e as i, f as o, m as y } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsx as d, Fragment as f } from "react/jsx-runtime";
|
|
3
|
-
import { u as h, d as I, A as v } from "./index-
|
|
3
|
+
import { u as h, d as I, A as v } from "./index-B0d-u29p.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
var M = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, k = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, A = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _ = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, x = g.create({
|