@soul-refiner/design-system 2.14.155 → 2.14.156
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/components/editor/constants.js +1 -1
- package/dist/components/editor/context.js +1 -1
- package/dist/components/editor/editor.js +8 -2
- package/dist/components/editor/plugins/highlights/floating-highlight-toolbar.js +38 -0
- package/dist/components/editor/plugins/highlights/highlight-button.js +37 -0
- package/dist/components/editor/plugins/highlights/highlight-decoration.js +1 -0
- package/dist/components/editor/plugins/highlights/highlight-leaf.js +46 -0
- package/dist/components/editor/plugins/highlights/highlights-dropdown.js +116 -0
- package/dist/components/editor/plugins/highlights/types.js +1 -0
- package/dist/components/editor/plugins/highlights/use-highlights.js +1 -0
- package/dist/components/editor/plugins/marks/marks.js +1 -1
- package/dist/components/editor/plugins/plate.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/components/editor/context.d.ts +3 -0
- package/dist/src/components/editor/context.d.ts.map +1 -1
- package/dist/src/components/editor/editor.d.ts +25 -1
- package/dist/src/components/editor/editor.d.ts.map +1 -1
- package/dist/src/components/editor/index.d.ts +5 -0
- package/dist/src/components/editor/index.d.ts.map +1 -1
- package/dist/src/components/editor/plugins/highlights/floating-highlight-toolbar.d.ts +20 -0
- package/dist/src/components/editor/plugins/highlights/floating-highlight-toolbar.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/highlight-button.d.ts +8 -0
- package/dist/src/components/editor/plugins/highlights/highlight-button.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/highlight-decoration.d.ts +25 -0
- package/dist/src/components/editor/plugins/highlights/highlight-decoration.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/highlight-leaf.d.ts +10 -0
- package/dist/src/components/editor/plugins/highlights/highlight-leaf.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/highlights-dropdown.d.ts +10 -0
- package/dist/src/components/editor/plugins/highlights/highlights-dropdown.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/index.d.ts +9 -0
- package/dist/src/components/editor/plugins/highlights/index.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/types.d.ts +26 -0
- package/dist/src/components/editor/plugins/highlights/types.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/highlights/use-highlights.d.ts +17 -0
- package/dist/src/components/editor/plugins/highlights/use-highlights.d.ts.map +1 -0
- package/dist/src/components/editor/plugins/marks/marks.d.ts.map +1 -1
- package/dist/src/components/editor/plugins/plate.d.ts +13 -0
- package/dist/src/components/editor/plugins/plate.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.BUTTON_LINK="button-link",exports.BUTTON_SUBSCRIBE="button-subscribe",exports.COLORS=["var(--color-turquoise-5)","var(--color-green-5)","var(--color-blue-5)","var(--color-purple-5)","var(--color-yellow-5)","var(--color-orange-5)","var(--color-red-5)"],exports.ELEMENT_AUDIO="audio",exports.ELEMENT_BIBLICAL_QUOTE="biblical-quote",exports.ELEMENT_BLOCKQUOTE="blockquote",exports.ELEMENT_BUTTON="button",exports.ELEMENT_H1="h1",exports.ELEMENT_H2="h2",exports.ELEMENT_H3="h3",exports.ELEMENT_H4="h4",exports.ELEMENT_H5="h5",exports.ELEMENT_H6="h6",exports.ELEMENT_HR="hr",exports.ELEMENT_IMAGE="img",exports.ELEMENT_LINK="a",exports.ELEMENT_MEDIA="media",exports.ELEMENT_MEDIA_EMBED="media_embed",exports.ELEMENT_OL="ol",exports.ELEMENT_PARAGRAPH="p",exports.ELEMENT_PRAYER_FOR_CHANGE="prayer_for_change",exports.ELEMENT_QA="q-n-a",exports.ELEMENT_TABLE="table",exports.ELEMENT_TD="td",exports.ELEMENT_TH="th",exports.ELEMENT_TODO_LI="todo_li",exports.ELEMENT_TR="tr",exports.ELEMENT_UL="ul",exports.ELEMENT_VIDEO="video",exports.MARK_BOLD="bold",exports.MARK_CODE="code",exports.MARK_ITALIC="italic",exports.MARK_LINK="link",exports.MARK_STRIKETHROUGH="strikethrough",exports.MARK_SUBSCRIPT="subscript",exports.MARK_SUPERSCRIPT="superscript",exports.MARK_UNDERLINE="underline",exports.PLACEHOLDER="This is a placeholder";
|
|
1
|
+
"use strict";exports.BUTTON_LINK="button-link",exports.BUTTON_SUBSCRIBE="button-subscribe",exports.COLORS=["var(--color-turquoise-5)","var(--color-green-5)","var(--color-blue-5)","var(--color-purple-5)","var(--color-yellow-5)","var(--color-orange-5)","var(--color-red-5)"],exports.ELEMENT_AUDIO="audio",exports.ELEMENT_BIBLICAL_QUOTE="biblical-quote",exports.ELEMENT_BLOCKQUOTE="blockquote",exports.ELEMENT_BUTTON="button",exports.ELEMENT_H1="h1",exports.ELEMENT_H2="h2",exports.ELEMENT_H3="h3",exports.ELEMENT_H4="h4",exports.ELEMENT_H5="h5",exports.ELEMENT_H6="h6",exports.ELEMENT_HR="hr",exports.ELEMENT_IMAGE="img",exports.ELEMENT_LINK="a",exports.ELEMENT_MEDIA="media",exports.ELEMENT_MEDIA_EMBED="media_embed",exports.ELEMENT_OL="ol",exports.ELEMENT_PARAGRAPH="p",exports.ELEMENT_PRAYER_FOR_CHANGE="prayer_for_change",exports.ELEMENT_QA="q-n-a",exports.ELEMENT_TABLE="table",exports.ELEMENT_TD="td",exports.ELEMENT_TH="th",exports.ELEMENT_TODO_LI="todo_li",exports.ELEMENT_TR="tr",exports.ELEMENT_UL="ul",exports.ELEMENT_VIDEO="video",exports.MARK_BOLD="bold",exports.MARK_CODE="code",exports.MARK_HIGHLIGHT="highlight",exports.MARK_ITALIC="italic",exports.MARK_LINK="link",exports.MARK_STRIKETHROUGH="strikethrough",exports.MARK_SUBSCRIPT="subscript",exports.MARK_SUPERSCRIPT="superscript",exports.MARK_UNDERLINE="underline",exports.PLACEHOLDER="This is a placeholder";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const o=t(require("react")).default.createContext({audioLoader:void 0,commentInputLoader:()=>e.jsx(e.Fragment,{}),commentLoader:()=>e.jsx(e.Fragment,{}),handleAudioClick:()=>{},handleVideoClick:()=>{},imageSrcLoader:async()=>"",videoTitleLoader:()=>e.jsx(e.Fragment,{}),filterComponent:void 0,defaultFilter:"",hideShowAnswersButton:!1,showAnswersBelowInput:!1});exports.EditorContext=o;
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const o=t(require("react")).default.createContext({audioLoader:void 0,commentInputLoader:()=>e.jsx(e.Fragment,{}),commentLoader:()=>e.jsx(e.Fragment,{}),handleAudioClick:()=>{},handleVideoClick:()=>{},imageSrcLoader:async()=>"",videoTitleLoader:()=>e.jsx(e.Fragment,{}),filterComponent:void 0,defaultFilter:"",hideShowAnswersButton:!1,showAnswersBelowInput:!1,enableHighlighting:!1,highlights:[]});exports.EditorContext=o;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("react"),t=require("styled-components"),o=require("@udecode/plate-common"),l=require("./constants.js"),n=require("./context.js"),r=require("./navbar/navbar.js"),a=require("./plugins/plate.js"),s=require("./plugins/blocks/blocks.js"),h=require("./plugins/leafs/leafs.js"),g=require("./plugins/marks/marks.js"),d=require("./plugins/utils/utils.js"),u=require("./plugins/highlights/use-highlights.js"),c=require("./plugins/highlights/highlight-decoration.js"),p=require("./plugins/highlights/floating-highlight-toolbar.js"),f=require("./plugins/highlights/highlight-button.js"),m=require("./plugins/highlights/highlights-dropdown.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=b(i);const H=o.createPlugins([...s.blocks,...h.leafs,...g.marks,...d.utils],{components:a.plateUI}),j=({decorate:i,enableHighlighting:t,editable:n,highlights:r,addHighlight:a,updateHighlight:s,removeHighlight:h,hasHighlights:g,onOpenNotes:d})=>{const u=o.useEditorRef(),c=x.default.useCallback((e,i)=>{a(u,e,i)},[u,a]),f=x.default.useCallback((e,i)=>{s(e,{color:i})},[s]);return e.jsxs(e.Fragment,{children:[e.jsx(o.PlateContent,{id:"main",autoFocus:!0,placeholder:l.PLACEHOLDER,readOnly:!n,spellCheck:!0,decorate:i,onContextMenu:e=>e.preventDefault(),onCopy:()=>{if("clipboard"in navigator)return navigator.clipboard.writeText("")}}),(t||g)&&e.jsx(p.FloatingHighlightToolbar,{highlights:r,onHighlight:c,onChangeColor:f,onRemoveHighlight:h,onOpenNotes:d})]})},v=t.styled.div`
|
|
3
3
|
* {
|
|
4
4
|
font-family: var(--font-inter);
|
|
5
5
|
outline: none;
|
|
@@ -75,4 +75,10 @@
|
|
|
75
75
|
max-width: 864px;
|
|
76
76
|
width: 100%;
|
|
77
77
|
margin: 0 auto;
|
|
78
|
-
|
|
78
|
+
`,y=t.styled.div`
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: flex-end;
|
|
81
|
+
padding: 4px 0;
|
|
82
|
+
`,C=t.styled.div`
|
|
83
|
+
position: relative;
|
|
84
|
+
`;exports.Editor=({audioLoader:i,commentInputLoader:t,commentLoader:l,editable:a,handleAudioClick:s,handleVideoClick:h,imageSrcLoader:g,onChange:d,previousContent:p,defaultFilter:b,videoTitleLoader:w,filterComponent:q,hideShowAnswersButton:k,showAnswersBelowInput:L,enableHighlighting:E=!1,initialHighlights:O,onHighlightsChange:A,onOpenNotes:R})=>{const{highlights:B,addHighlight:N,updateHighlight:D,removeHighlight:F}=u.useHighlights({initialHighlights:O,onHighlightsChange:A}),[I,M]=x.default.useState(!1);x.default.useEffect(()=>{"production"!==process.env.NODE_ENV&&a&&E&&console.warn("[Editor] enableHighlighting is only supported with editable={false}. Highlight positions are not reconciled when the document changes and will drift out of alignment after edits.")},[a,E]);const P=B.length>0,S=x.default.useMemo(()=>{if(0!==B.length)return c.createHighlightDecorate(B)},[B]);return e.jsx(n.EditorContext.Provider,{value:{audioLoader:i,commentInputLoader:t,commentLoader:l,handleAudioClick:s,handleVideoClick:h,imageSrcLoader:g,videoTitleLoader:w,defaultFilter:b,filterComponent:q,hideShowAnswersButton:k,showAnswersBelowInput:L,enableHighlighting:E,highlights:B},children:e.jsx(o.Plate,{id:"main",initialValue:p,onChange:d,plugins:H,children:e.jsxs(v,{children:[a&&e.jsx(r.EditorBar,{}),(E||P)&&e.jsx(y,{children:e.jsxs(C,{children:[e.jsx(f.HighlightButton,{count:B.length,isOpen:I,onClick:()=>M(e=>!e)}),e.jsx(m.HighlightsDropdown,{isOpen:I,highlights:B,onRemove:F,onClose:()=>M(!1)})]})}),e.jsx(j,{decorate:S,enableHighlighting:E,editable:a,highlights:B,addHighlight:N,updateHighlight:D,removeHighlight:F,hasHighlights:P,onOpenNotes:R})]})})})};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom"),o=require("styled-components"),i=require("@udecode/plate-common"),r=require("slate-react"),l=require("../../../feedback/tooltip/tooltip.js"),d=require("./types.js"),a=require("./use-highlights.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t);const u="#4A4F55",h="#eaebed",g=({color:t})=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M22.7448 12.0754L14.2002 3.6561C14.1825 3.63831 14.1615 3.6242 14.1383 3.61457C14.1151 3.60493 14.0903 3.59998 14.0652 3.59998C14.0401 3.59998 14.0152 3.60493 13.9921 3.61457C13.9689 3.6242 13.9479 3.63831 13.9302 3.6561L8.17507 9.3268C8.13886 9.36273 8.11829 9.41151 8.11783 9.46253C8.11738 9.51354 8.13709 9.56268 8.17266 9.59925L8.17507 9.60166L9.13948 10.5516L6.31377 13.3315C6.27755 13.3674 6.25698 13.4162 6.25653 13.4672C6.25608 13.5182 6.27578 13.5674 6.31136 13.6039L6.31377 13.6063L7.26612 14.5442L2.7069 19.0528H1.3953C1.28922 19.0528 1.20001 19.1396 1.20001 19.2457V20.5766C1.20001 20.6827 1.28681 20.7695 1.39289 20.7695H9.70848C9.75911 20.7695 9.80733 20.7502 9.8435 20.714L11.6783 18.8913L12.6523 19.8509C12.67 19.8687 12.6911 19.8828 12.7142 19.8924C12.7374 19.902 12.7623 19.907 12.7873 19.907C12.8124 19.907 12.8373 19.902 12.8605 19.8924C12.8836 19.8828 12.9047 19.8687 12.9224 19.8509L15.7457 17.0637L16.7125 18.0161C16.7302 18.0339 16.7512 18.048 16.7744 18.0576C16.7976 18.0673 16.8224 18.0722 16.8475 18.0722C16.8726 18.0722 16.8974 18.0673 16.9206 18.0576C16.9438 18.048 16.9648 18.0339 16.9825 18.0161L22.7376 12.3454C22.8196 12.2731 22.8196 12.1525 22.7448 12.0754ZM9.05509 19.0384H5.19265L8.43305 15.8317L10.3643 17.734L9.05509 19.0384ZM12.7873 17.5411L8.65487 13.4689L10.3088 11.8391L14.4413 15.9113L12.7873 17.5411ZM16.8499 15.7063L10.5138 9.46423L14.0652 5.96585L20.4013 12.2104L16.8499 15.7063Z",fill:t,stroke:u,strokeWidth:"0.5",paintOrder:"stroke fill"})}),p=()=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M6.4 19L5 17.6L10.6 12L5 6.4L6.4 5L12 10.6L17.6 5L19 6.4L13.4 12L19 17.6L17.6 19L12 13.4L6.4 19Z",fill:u})}),f=()=>e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0588 2H4C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H15.5039C16.6084 22 17.5039 21.1046 17.5039 20V14.7273H15.5039V20H7.44531V4H14.0588V2ZM5.44531 4V20H4L4 4H5.44531Z",fill:u}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.3118 6.73896L12.0089 16.5571H8.20703V12.5444L17.5099 2.7262C17.8898 2.32531 18.5056 2.32532 18.8855 2.72622L21.3118 5.2871C21.6917 5.68802 21.6917 6.33805 21.3118 6.73896ZM10.207 13.3414L18.1977 4.90819L19.2444 6.013L11.1487 14.5571H10.207V13.3414Z",fill:u})]}),m=o.styled.div`
|
|
2
|
+
position: absolute;
|
|
3
|
+
transform: translateX(-50%);
|
|
4
|
+
z-index: 9999;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
padding: 6px 16px;
|
|
9
|
+
background: ${"#ffffff"};
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.2);
|
|
12
|
+
pointer-events: auto;
|
|
13
|
+
`,L=o.styled.button`
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
width: 28px;
|
|
18
|
+
height: 28px;
|
|
19
|
+
padding: 2px;
|
|
20
|
+
background: ${e=>e.$active?`var(--color-grey-9, ${h})`:"none"};
|
|
21
|
+
border: none;
|
|
22
|
+
border-radius: 6px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition: background 0.15s ease;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
background: var(--color-grey-9, ${h});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus-visible {
|
|
31
|
+
outline: 2px solid var(--color-primary-blue-2, ${"#0076d9"});
|
|
32
|
+
outline-offset: 1px;
|
|
33
|
+
}
|
|
34
|
+
`,v=o.styled.div`
|
|
35
|
+
width: 1px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
background: var(--color-grey-8, ${"#e5e7eb"});
|
|
38
|
+
`;exports.FloatingHighlightToolbar=({highlights:t,onHighlight:o,onChangeColor:s,onRemoveHighlight:u,onOpenNotes:h})=>{const x=i.useEditorRef(),[C,w]=c.default.useState(null),[b,y]=c.default.useState(!1),j=c.default.useRef(null),E=c.default.useRef(null),R=c.default.useRef(null);if(c.default.useEffect(()=>y(!0),[]),c.default.useEffect(()=>{const e=()=>{const e=window.getSelection();if(!e||e.isCollapsed||!e.rangeCount)return void w(e=>"add"===e?.mode?null:e);let t=null;try{t=r.ReactEditor.toDOMNode(x,x)}catch{return}const n=e.getRangeAt(0);if(!t.contains(n.commonAncestorContainer))return;const o=n.getBoundingClientRect();if(0===o.width)return;let i=null;try{i=r.ReactEditor.toSlateRange(x,e,{exactMatch:!1,suppressThrow:!0})}catch{return}i&&w({mode:"add",range:i,position:{top:o.top+window.scrollY-48,left:o.left+window.scrollX+o.width/2}})};return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[x]),c.default.useEffect(()=>{const e=e=>{const t=e.target;if(!t)return;if(j.current?.contains(t))return;const n=t.closest("[data-highlight-id]");if(!n)return;let o=null;try{o=r.ReactEditor.toDOMNode(x,x)}catch{return}if(!o.contains(n))return;const i=window.getSelection();if(i&&!i.isCollapsed)return;const l=n.getAttribute("data-highlight-id");if(!l)return;const d=n.getBoundingClientRect();R.current=document.activeElement??null,w({mode:"edit",highlightId:l,position:{top:d.top+window.scrollY-48,left:d.left+window.scrollX+d.width/2}})};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[x]),c.default.useEffect(()=>{if("edit"===C?.mode){const e=window.requestAnimationFrame(()=>{E.current?.focus()});return()=>window.cancelAnimationFrame(e)}!C&&R.current&&(R.current.focus(),R.current=null)},[C]),c.default.useEffect(()=>{if(!C)return;const e=e=>{"Escape"===e.key&&(w(null),"add"===C.mode&&window.getSelection()?.removeAllRanges())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[C]),c.default.useEffect(()=>{if(!C)return;const e=e=>{if(j.current?.contains(e.target))return;const t=e.target?.closest?.("[data-highlight-id]");"edit"===C.mode&&t?.getAttribute("data-highlight-id")===C.highlightId||w(null)},t=setTimeout(()=>{document.addEventListener("mousedown",e)},100);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[C]),!b||!C)return null;const H="edit"===C.mode?t.find(e=>e.id===C.highlightId)?.color.toUpperCase():null;return n.createPortal(e.jsxs(m,{ref:j,role:"toolbar","aria-label":"Highlight options",style:{top:C.position.top,left:C.position.left},children:[d.HIGHLIGHT_COLORS.map((t,n)=>{const i=H===t.value.toUpperCase();return e.jsx(L,{ref:0===n?E:void 0,type:"button","aria-label":`Highlight ${t.label.toLowerCase()}`,"aria-pressed":i,$active:i,onClick:e=>{var n;e.preventDefault(),e.stopPropagation(),n=t.value,"add"===C.mode?o(n,C.range):"edit"===C.mode&&s&&s(C.highlightId,n),w(null)},children:e.jsx(g,{color:t.value})},t.value)}),e.jsx(l.Tooltip,{content:"edit"===C.mode?"Remove highlight":"Dismiss",place:"top",children:e.jsx(L,{type:"button","aria-label":"edit"===C.mode?"Remove highlight":"Dismiss",onClick:e=>{e.preventDefault(),e.stopPropagation(),"edit"===C.mode&&u?u(C.highlightId):window.getSelection()?.removeAllRanges(),w(null)},children:e.jsx(p,{})})}),h&&e.jsxs(e.Fragment,{children:[e.jsx(v,{}),e.jsx(l.Tooltip,{content:"Add to note",place:"top",children:e.jsx(L,{type:"button","aria-label":"Add to note",onClick:e=>{if(e.preventDefault(),e.stopPropagation(),"add"===C.mode){let e="";try{e=a.extractSnippetFromRange(x,C.range)}catch(e){"production"!==process.env.NODE_ENV&&console.warn("[FloatingHighlightToolbar] failed to extract snippet from range",e)}h({mode:"add",snippetText:e})}else{const e=t.find(e=>e.id===C.highlightId);h({mode:"edit",snippetText:e?.snippetText??"",highlightId:C.highlightId})}w(null)},children:e.jsx(f,{})})})]})]}),document.body)};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("styled-components");const r=i.styled.button`
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 36px;
|
|
7
|
+
height: 36px;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
border: 1px solid
|
|
10
|
+
${e=>e.$isOpen?"var(--color-primary-blue-1, #3b82f6)":"var(--color-grey-8, #e5e7eb)"};
|
|
11
|
+
background: ${e=>e.$isOpen?"var(--color-blue-9, #eff6ff)":"white"};
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
padding: 0;
|
|
14
|
+
transition: all 0.15s ease;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
border-color: var(--color-primary-blue-1, #3b82f6);
|
|
18
|
+
background: var(--color-blue-9, #eff6ff);
|
|
19
|
+
}
|
|
20
|
+
`,t=i.styled.span`
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: -4px;
|
|
23
|
+
right: -4px;
|
|
24
|
+
min-width: 16px;
|
|
25
|
+
height: 16px;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
padding: 0 4px;
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
background: var(--color-primary-blue-1, #3b82f6);
|
|
32
|
+
color: white;
|
|
33
|
+
font-size: 10px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
font-family: var(--font-inter);
|
|
36
|
+
line-height: 1;
|
|
37
|
+
`,o=()=>e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-grey-3, #374151)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]});exports.HighlightButton=({count:i,isOpen:n,onClick:l})=>e.jsxs(r,{onClick:l,$isOpen:n,title:"Highlights","aria-label":i>0?`Highlights (${i})`:"Highlights","aria-expanded":n,"aria-haspopup":"dialog","data-highlight-toggle":!0,children:[e.jsx(o,{}),i>0&&e.jsx(t,{children:i})]});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("slate"),e=require("../../constants.js");exports.createHighlightDecorate=o=>{const r=(e=>e.map(e=>{const o={path:e.anchorPath,offset:e.anchorOffset},r={path:e.focusPath,offset:e.focusOffset},[s,a]=t.Point.isBefore(o,r)?[o,r]:[r,o];return{id:e.id,color:e.color,start:s,end:a,startBlock:s.path[0],endBlock:a.path[0]}}))(o);return([o,s])=>{if(!t.Text.isText(o)||0===r.length)return[];const a=o.text.length;if(0===a)return[];const h=s[0],n=r.filter(t=>h>=t.startBlock&&h<=t.endBlock);if(0===n.length)return[];const c=[];for(const o of n){const r=t.Path.compare(s,o.start.path)>=0,h=t.Path.compare(s,o.end.path)<=0;if(!r||!h)continue;let n=0,f=a;t.Path.equals(s,o.start.path)&&(n=o.start.offset),t.Path.equals(s,o.end.path)&&(f=o.end.offset),n>=f||c.push({anchor:{path:s,offset:n},focus:{path:s,offset:f},[e.MARK_HIGHLIGHT]:!0,highlightId:o.id,highlightColor:o.color})}return c}};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("@udecode/plate-common"),o=require("styled-components"),i=require("./types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=a(t).default.forwardRef(({children:t,leaf:o,...a},l)=>{const s=r.useEditorReadOnly()?{role:"button",tabIndex:0}:{},d=o.highlightColor||i.DEFAULT_HIGHLIGHT_COLOR;return e.jsx(r.PlateLeaf,{ref:l,leaf:o,...a,children:e.jsx(n,{$color:d,$textColor:i.getHighlightTextColor(d),"data-highlight-id":o.highlightId,...s,children:t})})});l.displayName="HighlightLeaf";const n=o.styled.span`
|
|
2
|
+
background-color: ${e=>e.$color};
|
|
3
|
+
border-radius: 2px;
|
|
4
|
+
padding: 1px 0;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
transition: background-color 0.15s ease;
|
|
7
|
+
|
|
8
|
+
/* Must color both the highlight span AND its descendants. Slate renders
|
|
9
|
+
nested spans (data-slate-leaf / data-slate-string) inside the leaf, and
|
|
10
|
+
the Editor wrapper's '*:not(a):not(button)... { color: grey }' rule
|
|
11
|
+
targets each of those descendants directly — inheritance from the parent
|
|
12
|
+
span alone won't win. '&& *' doubles the class selector (→ 0,2,1) so it
|
|
13
|
+
beats the wrapper rule (0,1,4). */
|
|
14
|
+
&&,
|
|
15
|
+
&& * {
|
|
16
|
+
color: ${e=>e.$textColor};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
filter: brightness(0.92);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&[data-highlight-pulse='true'] {
|
|
24
|
+
animation: highlightPulse 1.5s ease-out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (prefers-reduced-motion: reduce) {
|
|
28
|
+
transition: none;
|
|
29
|
+
&[data-highlight-pulse='true'] {
|
|
30
|
+
animation: none;
|
|
31
|
+
outline: 2px solid var(--color-primary-blue-1, #3b82f6);
|
|
32
|
+
outline-offset: 1px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@keyframes highlightPulse {
|
|
37
|
+
0% {
|
|
38
|
+
outline: 2px solid var(--color-primary-blue-1, #3b82f6);
|
|
39
|
+
outline-offset: 1px;
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
outline: 2px solid transparent;
|
|
43
|
+
outline-offset: 4px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;exports.HighlightLeaf=l;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(t);const i=r.styled.div`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: calc(100% + 4px);
|
|
4
|
+
right: 0;
|
|
5
|
+
width: 320px;
|
|
6
|
+
max-height: 400px;
|
|
7
|
+
background: white;
|
|
8
|
+
border: 1px solid var(--color-grey-8, #e5e7eb);
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
11
|
+
z-index: 9998;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
`,l=r.styled.div`
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
padding: 12px 16px;
|
|
20
|
+
border-bottom: 1px solid var(--color-grey-9, #f3f4f6);
|
|
21
|
+
`,a=r.styled.span`
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: var(--color-grey-2, #1f2937);
|
|
25
|
+
font-family: var(--font-inter);
|
|
26
|
+
`,d=r.styled.span`
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
color: var(--color-grey-5, #6b7280);
|
|
30
|
+
background: var(--color-grey-9, #f3f4f6);
|
|
31
|
+
padding: 2px 8px;
|
|
32
|
+
border-radius: 10px;
|
|
33
|
+
font-family: var(--font-inter);
|
|
34
|
+
`,s=r.styled.div`
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
flex: 1;
|
|
37
|
+
padding: 4px;
|
|
38
|
+
`,c=r.styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 8px;
|
|
42
|
+
padding: 4px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
background: var(--color-grey-10, #f9fafb);
|
|
47
|
+
}
|
|
48
|
+
`,u=r.styled.button`
|
|
49
|
+
flex: 1;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
gap: 10px;
|
|
53
|
+
padding: 8px;
|
|
54
|
+
background: none;
|
|
55
|
+
border: none;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
text-align: left;
|
|
58
|
+
border-radius: 6px;
|
|
59
|
+
min-width: 0;
|
|
60
|
+
`,f=r.styled.div`
|
|
61
|
+
width: 10px;
|
|
62
|
+
height: 10px;
|
|
63
|
+
min-width: 10px;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background-color: ${e=>e.$color};
|
|
66
|
+
margin-top: 3px;
|
|
67
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
68
|
+
`,h=r.styled.span`
|
|
69
|
+
font-size: 13px;
|
|
70
|
+
color: var(--color-grey-3, #374151);
|
|
71
|
+
font-family: var(--font-inter);
|
|
72
|
+
line-height: 1.4;
|
|
73
|
+
display: -webkit-box;
|
|
74
|
+
-webkit-line-clamp: 2;
|
|
75
|
+
-webkit-box-orient: vertical;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
word-break: break-word;
|
|
78
|
+
`,p=r.styled.button`
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
width: 28px;
|
|
83
|
+
height: 28px;
|
|
84
|
+
min-width: 28px;
|
|
85
|
+
border-radius: 6px;
|
|
86
|
+
border: none;
|
|
87
|
+
background: none;
|
|
88
|
+
color: var(--color-grey-6, #9ca3af);
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
padding: 0;
|
|
91
|
+
transition: all 0.15s ease;
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
color: var(--color-red-1, #ef4444);
|
|
95
|
+
background: var(--color-red-9, #fef2f2);
|
|
96
|
+
}
|
|
97
|
+
`,g=r.styled.div`
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
align-items: center;
|
|
101
|
+
padding: 32px 24px;
|
|
102
|
+
gap: 8px;
|
|
103
|
+
`,x=r.styled.div`
|
|
104
|
+
margin-bottom: 4px;
|
|
105
|
+
opacity: 0.6;
|
|
106
|
+
`,v=r.styled.span`
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
color: var(--color-grey-4, #4b5563);
|
|
110
|
+
font-family: var(--font-inter);
|
|
111
|
+
`,m=r.styled.span`
|
|
112
|
+
font-size: 13px;
|
|
113
|
+
color: var(--color-grey-6, #9ca3af);
|
|
114
|
+
font-family: var(--font-inter);
|
|
115
|
+
text-align: center;
|
|
116
|
+
`;exports.HighlightsDropdown=({isOpen:t,highlights:r,onRemove:o,onClose:b})=>{const y=n.default.useRef(null),w=n.default.useRef(null),k=n.default.useRef([]),j=n.default.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null),k.current.forEach(e=>{e.removeAttribute("data-highlight-pulse")}),k.current=[]},[]),E=n.default.useCallback(e=>{const t=document.querySelectorAll(`[data-highlight-id="${e}"]`);0!==t.length&&(t[0].scrollIntoView({behavior:"smooth",block:"center"}),j(),k.current=Array.from(t),k.current.forEach(e=>{e.setAttribute("data-highlight-pulse","true")}),w.current=setTimeout(()=>{k.current.forEach(e=>{e.removeAttribute("data-highlight-pulse")}),k.current=[],w.current=null},1500))},[j]);n.default.useEffect(()=>j,[j]);const A=n.default.useRef(null);if(n.default.useEffect(()=>{if(t){A.current=document.activeElement??null;const e=window.requestAnimationFrame(()=>{y.current?.focus()});return()=>window.cancelAnimationFrame(e)}A.current&&(A.current.focus(),A.current=null)},[t]),n.default.useEffect(()=>{if(!t)return;const e=e=>{if("Escape"===e.key)return void b();if("Tab"!==e.key)return;const t=(()=>{const e=y.current;return e?Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(e=>!e.hasAttribute("disabled")):[]})();if(0===t.length)return e.preventDefault(),void y.current?.focus();const r=t[0],o=t[t.length-1],n=document.activeElement;e.shiftKey?n!==r&&n!==y.current||(e.preventDefault(),o.focus()):n===o&&(e.preventDefault(),r.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,b]),n.default.useEffect(()=>{if(!t)return;const e=e=>{if(y.current&&!y.current.contains(e.target)){if(e.target.closest("[data-highlight-toggle]"))return;b()}},r=setTimeout(()=>{document.addEventListener("mousedown",e)},50);return()=>{clearTimeout(r),document.removeEventListener("mousedown",e)}},[t,b]),!t)return null;const L=[...r].sort((e,t)=>t.createdAt-e.createdAt);return e.jsxs(i,{ref:y,role:"dialog","aria-label":"Highlights","aria-modal":"false",tabIndex:-1,children:[e.jsxs(l,{children:[e.jsx(a,{children:"Highlights"}),e.jsx(d,{children:r.length})]}),0===r.length?e.jsxs(g,{children:[e.jsx(x,{children:e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-grey-6, #9ca3af)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),e.jsx(v,{children:"No highlights yet"}),e.jsx(m,{children:"Select text to highlight important sections"})]}):e.jsx(s,{children:L.map(t=>e.jsxs(c,{children:[e.jsxs(u,{onClick:()=>{E(t.id),b()},children:[e.jsx(f,{$color:t.color}),e.jsx(h,{children:t.snippetText})]}),e.jsx(p,{onClick:e=>{e.stopPropagation(),o(t.id)},title:"Remove highlight",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]},t.id))})]})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=[{label:"Yellow",value:"#FBD33D"},{label:"Red",value:"#CF3A2E"},{label:"Blue",value:"#0076D9"},{label:"Green",value:"#288641"}],l=e[0].value,t="#4A4F55";exports.DEFAULT_HIGHLIGHT_COLOR=l,exports.HIGHLIGHT_COLORS=e,exports.getHighlightTextColor=e=>{const l=e.replace("#","");if(6!==l.length)return t;return(.299*parseInt(l.slice(0,2),16)+.587*parseInt(l.slice(2,4),16)+.114*parseInt(l.slice(4,6),16))/255>.6?t:"#FFFFFF"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("react"),e=require("slate"),n=require("./types.js");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(t);const a=()=>"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`h-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,r=(t,n,o=80)=>{const s=e.Editor.fragment(t,n).map(t=>e.Node.string(t)).join(" ").trim();return s.length<=o?s:s.slice(0,o).trimEnd()+"…"},f=t=>({anchor:{path:t.anchorPath,offset:t.anchorOffset},focus:{path:t.focusPath,offset:t.focusOffset}}),c=(t,n)=>{const o=e.Range.intersection(f(t),f(n));return null!==o&&!e.Range.isCollapsed(o)};exports.extractSnippetFromRange=r,exports.useHighlights=(t={})=>{const{initialHighlights:o=[],onHighlightsChange:i}=t,[u,h]=s.default.useState(o),l=s.default.useRef(u),d=s.default.useRef(i);d.current=i;const p=s.default.useCallback(t=>{l.current=t,h(t),d.current?.(t)},[]);return{highlights:u,addHighlight:s.default.useCallback((t,o=n.DEFAULT_HIGHLIGHT_COLOR,s)=>{const i=s||t.selection;if(!i||e.Range.isCollapsed(i))return;const u=r(t,i);if(!u)return;const h={id:a(),anchorPath:[...i.anchor.path],anchorOffset:i.anchor.offset,focusPath:[...i.focus.path],focusOffset:i.focus.offset,snippetText:u,color:o,createdAt:Date.now()},d=l.current,g=e.Range.start(f(h)),O=e.Range.end(f(h)),R=[];for(const n of d){if(!c(n,h)){R.push(n);continue}const o=e.Range.start(f(n)),s=e.Range.end(f(n));if(e.Point.isBefore(o,g)){const e={anchor:o,focus:g};R.push({...n,id:a(),anchorPath:[...o.path],anchorOffset:o.offset,focusPath:[...g.path],focusOffset:g.offset,snippetText:r(t,e),createdAt:Date.now()})}if(e.Point.isAfter(s,O)){const e={anchor:O,focus:s};R.push({...n,id:a(),anchorPath:[...O.path],anchorOffset:O.offset,focusPath:[...s.path],focusOffset:s.offset,snippetText:r(t,e),createdAt:Date.now()})}}R.push(h),p(R)},[p]),updateHighlight:s.default.useCallback((t,e)=>{const n=l.current,o=n.findIndex(e=>e.id===t);if(-1===o)return;const s={...n[o],...e,id:n[o].id},a=n[o];if(Object.keys(e).every(t=>a[t]===s[t]))return;const r=[...n];r[o]=s,p(r)},[p]),removeHighlight:s.default.useCallback(t=>{const e=l.current,n=e.filter(e=>e.id!==t);n.length!==e.length&&p(n)},[p]),clearAll:s.default.useCallback(()=>{p([])},[p])}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@udecode/plate");const r=[e.createBoldPlugin(),e.createFontBackgroundColorPlugin(),e.createFontSizePlugin(),e.createFontFamilyPlugin(),e.createItalicPlugin(),e.createStrikethroughPlugin(),e.createSubscriptPlugin(),e.createSuperscriptPlugin(),e.createUnderlinePlugin()];exports.marks=
|
|
1
|
+
"use strict";var e=require("@udecode/plate"),r=require("@udecode/plate-common"),t=require("../../constants.js");const i=r.createPluginFactory({key:t.MARK_HIGHLIGHT,isLeaf:!0}),c=[e.createBoldPlugin(),e.createFontBackgroundColorPlugin(),e.createFontSizePlugin(),e.createFontFamilyPlugin(),i(),e.createItalicPlugin(),e.createStrikethroughPlugin(),e.createSubscriptPlugin(),e.createSuperscriptPlugin(),e.createUnderlinePlugin()];exports.marks=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@udecode/cn"),E=require("@udecode/plate-common"),l=require("./leafs/link.js"),t=require("../constants.js"),
|
|
1
|
+
"use strict";var e=require("@udecode/cn"),E=require("@udecode/plate-common"),l=require("./leafs/link.js"),t=require("./highlights/highlight-leaf.js"),r=require("../constants.js"),s=require("./blocks/blockquote.js"),i=require("./blocks/biblical-quote.js"),T=require("./blocks/prayer_for_change.js"),L=require("./blocks/buttons.js"),a=require("./blocks/image.js"),o=require("./blocks/list.js"),n=require("./blocks/table.js"),_=require("./blocks/table-cell.js"),u=require("./blocks/table-row.js"),M=require("./blocks/text.js");const N={[r.ELEMENT_PARAGRAPH]:M.ParagraphElement,[r.ELEMENT_H1]:M.HOneElement,[r.ELEMENT_H2]:M.HTwoElement,[r.ELEMENT_H3]:M.HThreeElement,[r.ELEMENT_H4]:M.HFourElement,[r.ELEMENT_H5]:M.HFiveElement,[r.ELEMENT_H6]:M.HSixElement,[r.ELEMENT_BLOCKQUOTE]:s.BlockquoteElement,[r.ELEMENT_BIBLICAL_QUOTE]:i.BiblicalQuoteElement,[r.ELEMENT_PRAYER_FOR_CHANGE]:T.PrayerForChangeElement,[r.ELEMENT_LINK]:l.LinkElement,[r.ELEMENT_OL]:e.withProps(o.ListElement,{variant:r.ELEMENT_OL}),[r.ELEMENT_UL]:e.withProps(o.ListElement,{variant:r.ELEMENT_UL}),[r.ELEMENT_IMAGE]:a.ImageElement,[r.ELEMENT_BUTTON]:L.Button,[r.ELEMENT_TABLE]:n.TableElement,[r.ELEMENT_TD]:_.TableCellElement,[r.ELEMENT_TH]:_.TableCellHeaderElement,[r.ELEMENT_TR]:u.TableRowElement,[r.MARK_SUBSCRIPT]:e.withProps(E.PlateLeaf,{as:"sub"}),[r.MARK_SUPERSCRIPT]:e.withProps(E.PlateLeaf,{as:"sup"}),[r.MARK_HIGHLIGHT]:t.HighlightLeaf};exports.plateUI=N;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./components/actions/button/button.js"),o=require("./components/actions/dropdown/dropdown.js"),r=require("./components/actions/rate/rate.js"),t=require("./components/actions/switch/switch.js"),s=require("./components/actions/toggle/toggle.js"),
|
|
1
|
+
"use strict";var e=require("./components/actions/button/button.js"),o=require("./components/actions/dropdown/dropdown.js"),r=require("./components/actions/rate/rate.js"),t=require("./components/actions/switch/switch.js"),s=require("./components/actions/toggle/toggle.js"),i=require("./components/actions/upload/upload.js"),n=require("./components/actions/AccountSelector/selector.js"),a=require("./components/actions/stepIndicator/stepIndicator.js"),p=require("./components/atoms/box/box.js"),c=require("./components/atoms/image/image.js"),u=require("./components/atoms/layout/container.js"),m=require("./components/atoms/layout/grid.js"),d=require("./components/atoms/layout/inline.js"),l=require("./components/atoms/layout/section.js"),x=require("./components/atoms/layout/stack.js"),j=require("./components/atoms/hide/hide.js"),q=require("./components/atoms/highlighter/highlighter.js"),g=require("./components/atoms/seconds_to_duration/seconds_to_duration.js"),h=require("./components/atoms/typography/display.js"),b=require("./components/atoms/typography/heading.js"),y=require("./components/atoms/typography/paragraph.js"),C=require("./components/atoms/typography/typography.js"),T=require("./components/atoms/time_ago/time_ago.js"),_=require("./components/atoms/countdown/countdown.js"),w=require("./components/card/card.js"),f=require("./components/card/simple-course/horizontal-course-card.js"),S=require("./components/editor/editor.js"),I=require("./components/editor/simple_editor/simple_editor.js"),H=require("./components/editor/minimal_editor/minimal_editor.js"),P=require("./components/editor/plugins/highlights/types.js"),k=require("./components/editor/plugins/highlights/use-highlights.js"),D=require("./components/editor/plugins/highlights/highlight-button.js"),v=require("./components/editor/plugins/highlights/highlights-dropdown.js"),A=require("./components/feedback/badge/badge.js"),B=require("./components/feedback/banner/banner.js"),L=require("./components/feedback/loader/loader.js"),M=require("./components/feedback/notification/notification.js"),E=require("./components/feedback/progress/progress.js"),R=require("./components/feedback/toast/toast.js"),G=require("./components/feedback/tooltip/tooltip.js"),O=require("./components/feedback/animated_toast/animated_toast.js"),N=require("./components/feedback/emojiPicker/emoji-picker.js"),U=require("./components/feedback/emojiPicker/emoji-reactions.js"),V=require("./components/feedback/videoLoader/videoLoader.js"),F=require("./components/iconography/avatar/avatar.js"),z=require("./components/iconography/icon/icon.js"),J=require("./components/input/checkbox/checkbox.js"),K=require("./components/input/counter/counter.js"),Q=require("./components/input/date/date.js"),W=require("./components/input/filter/filter.js"),X=require("./components/input/radio/radio.js"),Y=require("./components/input/search/search.js"),Z=require("./components/input/select/select.js"),$=require("./components/input/text_area/text_area.js"),ee=require("./components/input/text_input/text_input.js"),oe=require("./components/input/calendar/calendar.js"),re=require("./components/input/time/time.js"),te=require("./components/input/time_input/time_input.js"),se=require("./components/input/dropdown-select/dropdown-select.js"),ie=require("./components/media/audio-player/audio-player.js"),ne=require("./components/media/audio-playlist/audio-playlist.js"),ae=require("./components/media/audio-preview/audio-preview.js"),pe=require("./components/media/video/video.js"),ce=require("./components/media/video-player/video.js"),ue=require("./components/media/audio-playlist/playing_indicator.js"),me=require("./components/navigation/breadcrumb/breadcrumb.js"),de=require("./components/navigation/inner/inner.js"),le=require("./components/navigation/tabs/tabs.js"),xe=require("./components/navigation/tabs/custom-tabs.js"),je=require("./components/surfaces/accordion/accordion.js"),qe=require("./components/surfaces/carousel/card/card.js"),ge=require("./components/surfaces/comment/comment.js"),he=require("./components/surfaces/discuss_post/discuss_post.js"),be=require("./components/surfaces/drawer/drawer.js"),ye=require("./components/surfaces/drawer/bottom-drawer.js"),Ce=require("./components/surfaces/message/message.js"),Te=require("./components/surfaces/modal/modal.js"),_e=require("./components/surfaces/portal/portal.js"),we=require("./components/surfaces/post/post.js"),fe=require("./components/surfaces/calendar_date/calendar_date.js"),Se=require("./components/surfaces/success_modal/success-modal.js"),Ie=require("./components/surfaces/trailer-modal/trailer-modal.js"),He=require("./components/table/table/table.js"),Pe=require("./components/custom/users_selection/users_selection.js"),ke=require("./components/custom/courses_selection/courses_selection.js"),De=require("./components/animation/carousel/Carousel.js"),ve=require("./components/animation/marquee/Marquee.js"),Ae=require("./icons/index.js"),Be=require("./emoji/emojis.json.js");exports.Button=e.Button,exports.Dropdown=o.Dropdown,exports.Rate=r.Rate,exports.Switch=t.Switch,exports.Toggle=s.Toggle,exports.Upload=i.Upload,exports.AccountSelector=n.AccountSelector,exports.StepIndicator=a.StepIndicator,exports.Box=p.Box,exports.Image=c.Image,exports.Container=u.Container,exports.Grid=m.Grid,exports.Inline=d.Inline,exports.Section=l.Section,exports.Stack=x.Stack,exports.HideButRender=j.HideButRender,exports.Highlighter=q.Highlighter,exports.SecToDuration=g.SecToDuration,exports.Display=h.Display,exports.H=b.H,exports.P=y.P,exports.Typography=C.Typography,exports.TimeAgo=T.TimeAgo,exports.Countdown=_.Countdown,exports.Card=w.Card,exports.HorizontalCourseCard=f.HorizontalCourseCard,exports.Editor=S.Editor,exports.SimpleEditor=I.SimpleEditor,exports.MinimalEditor=H.MinimalEditor,exports.DEFAULT_HIGHLIGHT_COLOR=P.DEFAULT_HIGHLIGHT_COLOR,exports.HIGHLIGHT_COLORS=P.HIGHLIGHT_COLORS,exports.useHighlights=k.useHighlights,exports.HighlightButton=D.HighlightButton,exports.HighlightsDropdown=v.HighlightsDropdown,exports.Badge=A.Badge,exports.Banner=B.Banner,exports.Loader=L.Loader,exports.Notification=M.Notification,exports.Progress=E.Progress,exports.Toast=R.Toast,exports.Tooltip=G.Tooltip,exports.AnimatedToast=O.AnimatedToast,exports.CustomEmojiPicker=N.CustomEmojiPicker,exports.EmojiReaction=U.EmojiReaction,exports.VideoLoader=V.VideoLoader,exports.Avatar=F.Avatar,exports.Icon=z.Icon,exports.Checkbox=J.Checkbox,exports.Counter=K.Counter,exports.DatePicker=Q.DatePicker,exports.Filter=W.Filter,exports.Radio=X.Radio,exports.Search=Y.Search,exports.Select=Z.Select,exports.TextArea=$.TextArea,exports.TextInput=ee.TextInput,exports.CalendarInput=oe.CalendarInput,exports.Time=re.Time,exports.TimeInput=te.TimeInput,exports.DropdownSelect=se.DropdownSelect,exports.AudioPlayer=ie.AudioPlayer,exports.AudioPlaylist=ne.AudioPlaylist,exports.AudioPreview=ae.AudioPreview,exports.Video=pe.Video,exports.VideoPlayer=ce.VideoPlayer,exports.NowPlaying=ue.NowPlaying,exports.Breadcrumb=me.Breadcrumb,exports.InnerNav=de.InnerNav,exports.Tabs=le.Tabs,exports.CustomTabs=xe.CustomTabs,exports.Accordion=je.Accordion,exports.CardCarousel=qe.CardCarousel,exports.Comment=ge.Comment,exports.DiscussPost=he.DiscussPost,exports.Drawer=be.Drawer,exports.BottomDrawer=ye.BottomDrawer,exports.Message=Ce.Message,exports.Modal=Te.Modal,exports.Portal=_e.Portal,exports.Post=we.Post,exports.CalendarDate=fe.CalendarDate,exports.SuccessModal=Se.SuccessModal,exports.TrailerModal=Ie.TrailerModal,exports.Table=He.Table,exports.UsersSelection=Pe.UsersSelection,exports.CoursesSelection=ke.CoursesSelection,exports.Carousel=De.Carousel,exports.Marquee=ve.Marquee,exports.Icons=Ae,exports.emoji=Be;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { HighlightData } from './plugins/highlights/types';
|
|
2
3
|
export interface CommentLoaderProps {
|
|
3
4
|
questionAnswerId: string;
|
|
4
5
|
filterType: string;
|
|
@@ -30,5 +31,7 @@ export declare const EditorContext: React.Context<{
|
|
|
30
31
|
defaultFilter?: string;
|
|
31
32
|
hideShowAnswersButton?: boolean;
|
|
32
33
|
showAnswersBelowInput?: boolean;
|
|
34
|
+
enableHighlighting?: boolean;
|
|
35
|
+
highlights?: HighlightData[];
|
|
33
36
|
}>;
|
|
34
37
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa;kBACV,CAAC,KAAK,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,YAAY;wBAClD,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,YAAY;mBACrD,CAAC,KAAK,EAAE,kBAAkB,KAAK,MAAM,YAAY;uBAC7C,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;uBACpB,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;oBACvB,CAAC,EAAE,EAAE,MAAM,KAAK,QAAQ,MAAM,CAAC;sBAC7B,CAAC,KAAK,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,YAAY;sBACxD,MAAM,aAAa,CAAC,oBAAoB,CAAC;oBAC3C,MAAM;4BACE,OAAO;4BACP,OAAO;yBACV,OAAO;iBACf,aAAa,EAAE;EAe5B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TElement } from '@udecode/plate-common';
|
|
3
3
|
import { CommentInputProps, CommentLoaderProps, FilterComponentProps } from './context';
|
|
4
|
+
import { HighlightData } from './plugins/highlights/types';
|
|
4
5
|
export interface EditorProps {
|
|
5
6
|
audioLoader?: (props: {
|
|
6
7
|
courseMediaId: number;
|
|
@@ -20,7 +21,30 @@ export interface EditorProps {
|
|
|
20
21
|
filterComponent?: React.ComponentType<FilterComponentProps>;
|
|
21
22
|
hideShowAnswersButton?: boolean;
|
|
22
23
|
showAnswersBelowInput?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Enables the floating highlight toolbar and the highlights dropdown.
|
|
26
|
+
*
|
|
27
|
+
* Only supported in read-only mode (`editable={false}`). `HighlightData`
|
|
28
|
+
* stores Slate path-based coordinates (`anchorPath` / `focusPath`), and
|
|
29
|
+
* those paths are NOT rebased when the document is edited — any insertion
|
|
30
|
+
* or deletion before a highlighted range will silently shift the stored
|
|
31
|
+
* paths out of alignment with the text they were meant to mark.
|
|
32
|
+
*
|
|
33
|
+
* Passing `enableHighlighting` with `editable={true}` will emit a
|
|
34
|
+
* development-mode warning.
|
|
35
|
+
*/
|
|
36
|
+
enableHighlighting?: boolean;
|
|
37
|
+
initialHighlights?: HighlightData[];
|
|
38
|
+
onHighlightsChange?: (highlights: HighlightData[]) => void;
|
|
39
|
+
onOpenNotes?: (payload: {
|
|
40
|
+
mode: 'add';
|
|
41
|
+
snippetText: string;
|
|
42
|
+
} | {
|
|
43
|
+
mode: 'edit';
|
|
44
|
+
snippetText: string;
|
|
45
|
+
highlightId: string;
|
|
46
|
+
}) => void;
|
|
23
47
|
}
|
|
24
48
|
export type EditorContent = TElement;
|
|
25
|
-
export declare const Editor: ({ audioLoader, commentInputLoader, commentLoader, editable, handleAudioClick, handleVideoClick, imageSrcLoader, onChange, previousContent, defaultFilter, videoTitleLoader, filterComponent, hideShowAnswersButton, showAnswersBelowInput, }: EditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare const Editor: ({ audioLoader, commentInputLoader, commentLoader, editable, handleAudioClick, handleVideoClick, imageSrcLoader, onChange, previousContent, defaultFilter, videoTitleLoader, filterComponent, hideShowAnswersButton, showAnswersBelowInput, enableHighlighting, initialHighlights, onHighlightsChange, onOpenNotes, }: EditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
50
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAIL,QAAQ,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAIL,QAAQ,EAET,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAElB,oBAAoB,EACrB,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAe3D,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,YAAY,CAAC;IACvE,kBAAkB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC;IACrE,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,YAAY,CAAC;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,CAAC,KAAK,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,YAAY,CAAC;IAC3E,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC5D,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,aAAa,EAAE,CAAC;IACpC,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC3D,WAAW,CAAC,EAAE,CACZ,OAAO,EACH;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACpC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAC3D,IAAI,CAAC;CACX;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC,eAAO,MAAM,MAAM,yTAmBhB,WAAW,4CA0Fb,CAAC"}
|
|
@@ -4,4 +4,9 @@ export { SimpleEditor } from './simple_editor';
|
|
|
4
4
|
export type { SimpleEditorProps } from './simple_editor';
|
|
5
5
|
export { MinimalEditor } from './minimal_editor';
|
|
6
6
|
export type { MinimalEditorProps } from './minimal_editor';
|
|
7
|
+
export type { HighlightData } from './plugins/highlights/types';
|
|
8
|
+
export { HIGHLIGHT_COLORS, DEFAULT_HIGHLIGHT_COLOR, } from './plugins/highlights/types';
|
|
9
|
+
export { useHighlights } from './plugins/highlights/use-highlights';
|
|
10
|
+
export { HighlightButton } from './plugins/highlights/highlight-button';
|
|
11
|
+
export { HighlightsDropdown } from './plugins/highlights/highlights-dropdown';
|
|
7
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseRange } from 'slate';
|
|
3
|
+
import { HighlightData } from './types';
|
|
4
|
+
interface FloatingHighlightToolbarProps {
|
|
5
|
+
highlights: HighlightData[];
|
|
6
|
+
onHighlight: (color: string, range: BaseRange) => void;
|
|
7
|
+
onChangeColor?: (id: string, color: string) => void;
|
|
8
|
+
onRemoveHighlight?: (id: string) => void;
|
|
9
|
+
onOpenNotes?: (payload: {
|
|
10
|
+
mode: 'add';
|
|
11
|
+
snippetText: string;
|
|
12
|
+
} | {
|
|
13
|
+
mode: 'edit';
|
|
14
|
+
snippetText: string;
|
|
15
|
+
highlightId: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const FloatingHighlightToolbar: ({ highlights, onHighlight, onChangeColor, onRemoveHighlight, onOpenNotes, }: FloatingHighlightToolbarProps) => React.ReactPortal;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=floating-highlight-toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-highlight-toolbar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/floating-highlight-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,UAAU,6BAA6B;IAIrC,UAAU,EAAE,aAAa,EAAE,CAAC;IAE5B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAEvD,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpD,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAazC,WAAW,CAAC,EAAE,CACZ,OAAO,EACH;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACpC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAC3D,IAAI,CAAC;CACX;AA0BD,eAAO,MAAM,wBAAwB,gFAMlC,6BAA6B,sBAgT/B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface HighlightButtonProps {
|
|
2
|
+
count: number;
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const HighlightButton: ({ count, isOpen, onClick, }: HighlightButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=highlight-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-button.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/highlight-button.tsx"],"names":[],"mappings":"AAGA,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,gCAIzB,oBAAoB,4CAetB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TNodeEntry } from '@udecode/plate-common';
|
|
2
|
+
import { BaseRange } from 'slate';
|
|
3
|
+
import { HighlightData } from './types';
|
|
4
|
+
import { MARK_HIGHLIGHT } from '../../constants';
|
|
5
|
+
/**
|
|
6
|
+
* A Slate decoration range augmented with the metadata HighlightLeaf needs.
|
|
7
|
+
* Slate's decorate API allows extra properties on ranges; consumers (like
|
|
8
|
+
* decorated leaf renderers) can read them off the leaf.
|
|
9
|
+
*/
|
|
10
|
+
export type HighlightRange = BaseRange & {
|
|
11
|
+
[MARK_HIGHLIGHT]: true;
|
|
12
|
+
highlightId: string;
|
|
13
|
+
highlightColor: string;
|
|
14
|
+
};
|
|
15
|
+
export type HighlightDecorate = (entry: TNodeEntry) => HighlightRange[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates a decorate function that renders highlights as Slate decorations.
|
|
18
|
+
* Decorations are visual-only — they don't modify the source content.
|
|
19
|
+
*
|
|
20
|
+
* Performance: highlights are normalized once at creation time.
|
|
21
|
+
* Per text node, we skip highlights whose block range doesn't include
|
|
22
|
+
* the current node's top-level block, reducing work for large documents.
|
|
23
|
+
*/
|
|
24
|
+
export declare const createHighlightDecorate: (highlights: HighlightData[]) => HighlightDecorate;
|
|
25
|
+
//# sourceMappingURL=highlight-decoration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-decoration.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/highlight-decoration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,cAAc,EAAE,CAAC;AAoCxE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,eACtB,aAAa,EAAE,KAC1B,iBAkDF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PlateLeafProps } from '@udecode/plate-common';
|
|
3
|
+
export interface HighlightLeafProps extends PlateLeafProps {
|
|
4
|
+
leaf: PlateLeafProps['leaf'] & {
|
|
5
|
+
highlightId?: string;
|
|
6
|
+
highlightColor?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const HighlightLeaf: React.ForwardRefExoticComponent<Omit<HighlightLeafProps, "ref"> & React.RefAttributes<any>>;
|
|
10
|
+
//# sourceMappingURL=highlight-leaf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-leaf.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/highlight-leaf.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,EAEf,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;QAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,aAAa,6FA4BxB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HighlightData } from './types';
|
|
2
|
+
interface HighlightsDropdownProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
highlights: HighlightData[];
|
|
5
|
+
onRemove: (id: string) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const HighlightsDropdown: ({ isOpen, highlights, onRemove, onClose, }: HighlightsDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=highlights-dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlights-dropdown.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/highlights-dropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,uBAAuB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAID,eAAO,MAAM,kBAAkB,+CAK5B,uBAAuB,4CAgOzB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { HighlightData } from './types';
|
|
2
|
+
export { HIGHLIGHT_COLORS, DEFAULT_HIGHLIGHT_COLOR } from './types';
|
|
3
|
+
export { useHighlights } from './use-highlights';
|
|
4
|
+
export { createHighlightDecorate } from './highlight-decoration';
|
|
5
|
+
export { HighlightLeaf } from './highlight-leaf';
|
|
6
|
+
export { FloatingHighlightToolbar } from './floating-highlight-toolbar';
|
|
7
|
+
export { HighlightButton } from './highlight-button';
|
|
8
|
+
export { HighlightsDropdown } from './highlights-dropdown';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface HighlightData {
|
|
2
|
+
id: string;
|
|
3
|
+
anchorPath: number[];
|
|
4
|
+
anchorOffset: number;
|
|
5
|
+
focusPath: number[];
|
|
6
|
+
focusOffset: number;
|
|
7
|
+
snippetText: string;
|
|
8
|
+
color: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const HIGHLIGHT_COLORS: readonly [{
|
|
12
|
+
readonly label: "Yellow";
|
|
13
|
+
readonly value: "#FBD33D";
|
|
14
|
+
}, {
|
|
15
|
+
readonly label: "Red";
|
|
16
|
+
readonly value: "#CF3A2E";
|
|
17
|
+
}, {
|
|
18
|
+
readonly label: "Blue";
|
|
19
|
+
readonly value: "#0076D9";
|
|
20
|
+
}, {
|
|
21
|
+
readonly label: "Green";
|
|
22
|
+
readonly value: "#288641";
|
|
23
|
+
}];
|
|
24
|
+
export declare const DEFAULT_HIGHLIGHT_COLOR: "#FBD33D";
|
|
25
|
+
export declare const getHighlightTextColor: (hex: string) => string;
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAKnB,CAAC;AAEX,eAAO,MAAM,uBAAuB,WAA4B,CAAC;AAQjE,eAAO,MAAM,qBAAqB,QAAS,MAAM,KAAG,MAQnD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseRange, Editor } from 'slate';
|
|
2
|
+
import { HighlightData } from './types';
|
|
3
|
+
interface UseHighlightsOptions {
|
|
4
|
+
initialHighlights?: HighlightData[];
|
|
5
|
+
onHighlightsChange?: (highlights: HighlightData[]) => void;
|
|
6
|
+
}
|
|
7
|
+
interface UseHighlightsReturn {
|
|
8
|
+
highlights: HighlightData[];
|
|
9
|
+
addHighlight: (editor: Editor, color?: string, explicitRange?: BaseRange) => void;
|
|
10
|
+
updateHighlight: (id: string, patch: Partial<HighlightData>) => void;
|
|
11
|
+
removeHighlight: (id: string) => void;
|
|
12
|
+
clearAll: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const extractSnippetFromRange: (editor: Editor, range: BaseRange, maxLength?: number) => string;
|
|
15
|
+
export declare const useHighlights: (options?: UseHighlightsOptions) => UseHighlightsReturn;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-highlights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-highlights.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/highlights/use-highlights.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,aAAa,EAA2B,MAAM,SAAS,CAAC;AAEjE,UAAU,oBAAoB;IAC5B,iBAAiB,CAAC,EAAE,aAAa,EAAE,CAAC;IACpC,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;CAC5D;AAED,UAAU,mBAAmB;IAC3B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,YAAY,EAAE,CACZ,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,SAAS,KACtB,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACrE,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAmBD,eAAO,MAAM,uBAAuB,WAC1B,MAAM,SACP,SAAS,yBAEf,MASF,CAAC;AAgBF,eAAO,MAAM,aAAa,aACf,oBAAoB,KAC5B,mBA2IF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/marks/marks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../../../../../../src/components/editor/plugins/marks/marks.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,KAAK,OAWjB,CAAC"}
|
|
@@ -116,5 +116,18 @@ export declare const plateUI: {
|
|
|
116
116
|
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
117
117
|
ref?: import("react").Ref<any>;
|
|
118
118
|
} & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<any>>;
|
|
119
|
+
highlight: (<V extends import("@udecode/slate").Value = import("@udecode/slate").Value, N extends import("@udecode/slate").TText = import("@udecode/slate").EText<V>>({ className, ...props }: {
|
|
120
|
+
leafToAttributes?: (leaf: N) => any;
|
|
121
|
+
} & import("@udecode/plate-common").PlateRenderNodeProps<V, import("@udecode/plate-common").PlateEditor<V>> & Omit<import("slate-react").RenderLeafProps, "leaf" | "text"> & {
|
|
122
|
+
leaf: N;
|
|
123
|
+
text: N;
|
|
124
|
+
} & Omit<{
|
|
125
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>;
|
|
126
|
+
asChild?: boolean;
|
|
127
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
128
|
+
ref?: import("react").Ref<any>;
|
|
129
|
+
} & import("react").RefAttributes<HTMLSpanElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
130
|
+
displayName?: string;
|
|
131
|
+
};
|
|
119
132
|
};
|
|
120
133
|
//# sourceMappingURL=plate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plate.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/plugins/plate.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"plate.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/plugins/plate.ts"],"names":[],"mappings":";AAuBA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BnB,CAAC"}
|