@soul-refiner/design-system 2.14.164 → 2.14.165
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("@udecode/plate-common"),o=require("@udecode/plate-media"),i=require("../../feedback/tooltip/tooltip.js"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("@udecode/plate-common"),o=require("@udecode/plate-media"),i=require("@udecode/plate-link"),c=require("../../feedback/tooltip/tooltip.js"),s=require("../navbar/alignment_dropdown.js"),l=require("../navbar/style_dropdown.js"),d=require("../../../icons/basic/bold.js"),a=require("../../../icons/basic/image.js"),u=require("../../../icons/basic/italic.js"),p=require("../../../icons/basic/link.js"),x=require("../../../icons/text/list_ordered.js"),j=require("../../../icons/text/list_unordered.js"),g=require("../../../icons/arrow/redo.js"),h=require("../../../icons/basic/underline.js"),f=require("../../../icons/arrow/undo.js"),y=require("../../../icons/audio_video/microphone.js"),v=require("../constants.js"),E=require("../styles/menu_button.js");function M(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=M(t);const T="undefined"!=typeof window?window.SpeechRecognition||window.webkitSpeechRecognition:void 0,m=r.styled.nav`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: 12px;
|
|
4
4
|
justify-content: center;
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
align-items: center;
|
|
16
16
|
width: fit-content;
|
|
17
17
|
flex-shrink: 0;
|
|
18
|
-
`,
|
|
18
|
+
`,L=r.styled.div`
|
|
19
19
|
width: 1px;
|
|
20
20
|
height: 28px;
|
|
21
21
|
background-color: var(--color-grey-9);
|
|
22
|
-
`;exports.EditorBar=({handleUploadImage:t,showLink:r=!0,showImage:M=!0})=>{const
|
|
22
|
+
`;exports.EditorBar=({handleUploadImage:t,showLink:r=!0,showImage:M=!0})=>{const R=n.useEditorRef("main"),b=k.default.useRef(null),[q,A]=k.default.useState(!1),_=k.default.useRef(null),B=k.default.useRef(""),N=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_BOLD),[]),I=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_ITALIC),[]),C=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_UNDERLINE),[]),S=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,v.ELEMENT_OL)}}),[]),U=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,v.ELEMENT_UL)}}),[]),z=k.default.useRef(R.selection);k.default.useEffect(()=>{R.selection&&(z.current=R.selection)},[R.selection]),k.default.useEffect(()=>()=>{_.current&&(_.current.stop(),_.current=null)},[]);const $=k.default.useCallback(e=>{if(!e)return;const t=z.current;t?(R.select(t),R.insertText(e+" ")):n.insertNode(R,{type:v.ELEMENT_PARAGRAPH,children:[{text:e+" "}]})},[R]);return e.jsxs(m,{"aria-label":"editor-navigation",children:[e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Undo",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>R.undo(),children:e.jsx(f.Undo,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Redo",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>R.redo(),children:e.jsx(g.Redo,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsx(w,{children:e.jsx(l.StyleDropdown,{editorRef:R})}),e.jsx(L,{}),e.jsx(w,{children:e.jsx(E.MenuButton,{$active:!1,as:"div",children:e.jsx(s.AlignmentDropdown,{editorRef:R})})}),e.jsx(L,{}),e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Bold",place:"top",children:e.jsx(E.MenuButton,{$active:N,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_BOLD})},children:e.jsx(d.Bold,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Italic",place:"top",children:e.jsx(E.MenuButton,{$active:I,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_ITALIC})},children:e.jsx(u.Italic,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Underline",place:"top",children:e.jsx(E.MenuButton,{$active:C,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_UNDERLINE})},children:e.jsx(h.Underline,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsxs(w,{children:[r&&e.jsx(c.Tooltip,{content:"Link",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>{R&&i.triggerFloatingLink(R,{focused:!0})},children:e.jsx(p.Link,{size:24,color:"grey-5"})})}),M&&e.jsx(c.Tooltip,{content:"Image",place:"top",children:e.jsx(E.MenuButton,{$active:!1,as:"label",onChange:async()=>{const e=b.current?.files;if(!e)return;const r=await t(e);r&&(o.insertImage(R,r),n.insertNode(R,{type:v.ELEMENT_PARAGRAPH,children:[{text:" "}]}))},children:e.jsxs("div",{children:[e.jsx("input",{accept:"image/*",ref:b,style:{display:"none"},type:"file"}),e.jsx(a.Image,{size:24,color:"grey-5"})]})})}),T&&e.jsx(c.Tooltip,{content:q?"Stop and insert speech":"Speech to text",place:"top",children:e.jsx(E.MenuButton,{$active:q,onClick:()=>{if(!R)return;if(q)return _.current?void _.current.stop():void A(!1);if(_.current&&!q&&(_.current.stop(),_.current=null),!T)return;B.current="";const e=new T;e.continuous=!0,e.interimResults=!1,e.lang=navigator.language||"en-US",e.onresult=e=>{for(let t=e.resultIndex;t<e.results.length;t++){const r=e.results[t];if(r.isFinal&&r.length>0){const e=r[0].transcript;"string"==typeof e&&(B.current+=e)}}},e.onend=()=>{if(_.current===e){_.current=null,A(!1);const e=B.current.trim();B.current="",e&&$(e)}},e.onerror=e=>{console.error("Speech recognition error:",e.error),_.current=null,A(!1),B.current="","not-allowed"!==e.error&&"service-not-allowed"!==e.error||console.warn("Microphone access denied or not available")};try{e.start(),_.current=e,A(!0)}catch{A(!1)}},"aria-pressed":q,children:e.jsx(y.Microphone,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Unordered List",place:"top",children:e.jsx(E.MenuButton,{$active:U,onClick:()=>{R&&n.toggleNodeType(R,{activeType:n.getPluginType(R,v.ELEMENT_UL)})},children:e.jsx(j.ListUnordered,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Ordered List",place:"top",children:e.jsx(E.MenuButton,{$active:S,onClick:()=>{R&&n.toggleNodeType(R,{activeType:n.getPluginType(R,v.ELEMENT_OL)})},children:e.jsx(x.ListOrdered,{size:24,color:"grey-5"})})})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/simple_editor/navbar.tsx"],"names":[],"mappings":"AAoCA,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD,eAAO,MAAM,SAAS,gDAInB,cAAc,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/simple_editor/navbar.tsx"],"names":[],"mappings":"AAoCA,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD,eAAO,MAAM,SAAS,gDAInB,cAAc,4CAuShB,CAAC"}
|