@sparrowengg/twigs-editor-react 0.0.1
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/README.md +38 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js +8 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/cjs/_virtual/assertString.js +6 -0
- package/dist/cjs/_virtual/assertString.js.map +1 -0
- package/dist/cjs/_virtual/isFQDN.js +6 -0
- package/dist/cjs/_virtual/isFQDN.js.map +1 -0
- package/dist/cjs/_virtual/isIP.js +6 -0
- package/dist/cjs/_virtual/isIP.js.map +1 -0
- package/dist/cjs/_virtual/isURL.js +12 -0
- package/dist/cjs/_virtual/isURL.js.map +1 -0
- package/dist/cjs/_virtual/isURL2.js +6 -0
- package/dist/cjs/_virtual/isURL2.js.map +1 -0
- package/dist/cjs/_virtual/merge.js +6 -0
- package/dist/cjs/_virtual/merge.js.map +1 -0
- package/dist/cjs/components/base-dropdown/index.js +175 -0
- package/dist/cjs/components/base-dropdown/index.js.map +1 -0
- package/dist/cjs/components/dialog-link-editor/index.js +291 -0
- package/dist/cjs/components/dialog-link-editor/index.js.map +1 -0
- package/dist/cjs/components/dialog-link-editor/link-editor-dialog.js +199 -0
- package/dist/cjs/components/dialog-link-editor/link-editor-dialog.js.map +1 -0
- package/dist/cjs/components/dialog-link-editor/link-tooltip.js +122 -0
- package/dist/cjs/components/dialog-link-editor/link-tooltip.js.map +1 -0
- package/dist/cjs/components/floating-toolbar/floating-toolbar.js +302 -0
- package/dist/cjs/components/floating-toolbar/floating-toolbar.js.map +1 -0
- package/dist/cjs/components/rich-editor/index.js +142 -0
- package/dist/cjs/components/rich-editor/index.js.map +1 -0
- package/dist/cjs/components/toolbar/toolbar.js +76 -0
- package/dist/cjs/components/toolbar/toolbar.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/bold.js +52 -0
- package/dist/cjs/components/toolbar/tools/bold.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/code-block.js +79 -0
- package/dist/cjs/components/toolbar/tools/code-block.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/code.js +54 -0
- package/dist/cjs/components/toolbar/tools/code.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/commons.js +16 -0
- package/dist/cjs/components/toolbar/tools/commons.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/format.js +136 -0
- package/dist/cjs/components/toolbar/tools/format.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/italic.js +57 -0
- package/dist/cjs/components/toolbar/tools/italic.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/link.js +71 -0
- package/dist/cjs/components/toolbar/tools/link.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/ordered-list.js +62 -0
- package/dist/cjs/components/toolbar/tools/ordered-list.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/text-align.js +82 -0
- package/dist/cjs/components/toolbar/tools/text-align.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/underline.js +57 -0
- package/dist/cjs/components/toolbar/tools/underline.js.map +1 -0
- package/dist/cjs/components/toolbar/tools/unordered-list.js +62 -0
- package/dist/cjs/components/toolbar/tools/unordered-list.js.map +1 -0
- package/dist/cjs/components/toolbar-context/context.js +148 -0
- package/dist/cjs/components/toolbar-context/context.js.map +1 -0
- package/dist/cjs/components/toolbar-context/store.js +75 -0
- package/dist/cjs/components/toolbar-context/store.js.map +1 -0
- package/dist/cjs/components/toolbar-context/utils.js +6 -0
- package/dist/cjs/components/toolbar-context/utils.js.map +1 -0
- package/dist/cjs/editor.js +154 -0
- package/dist/cjs/editor.js.map +1 -0
- package/dist/cjs/index.js +86 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/nodes/emoji.js +86 -0
- package/dist/cjs/nodes/emoji.js.map +1 -0
- package/dist/cjs/nodes/hashtag.js +109 -0
- package/dist/cjs/nodes/hashtag.js.map +1 -0
- package/dist/cjs/nodes/image.js +215 -0
- package/dist/cjs/nodes/image.js.map +1 -0
- package/dist/cjs/nodes/kudos.js +110 -0
- package/dist/cjs/nodes/kudos.js.map +1 -0
- package/dist/cjs/nodes/mention.js +109 -0
- package/dist/cjs/nodes/mention.js.map +1 -0
- package/dist/cjs/nodes/variables.js +109 -0
- package/dist/cjs/nodes/variables.js.map +1 -0
- package/dist/cjs/plugins/data-management-plugin/index.js +40 -0
- package/dist/cjs/plugins/data-management-plugin/index.js.map +1 -0
- package/dist/cjs/plugins/emoji/emoji-list.js +16609 -0
- package/dist/cjs/plugins/emoji/emoji-list.js.map +1 -0
- package/dist/cjs/plugins/emoji/index.js +126 -0
- package/dist/cjs/plugins/emoji/index.js.map +1 -0
- package/dist/cjs/plugins/hashtag/index.js +100 -0
- package/dist/cjs/plugins/hashtag/index.js.map +1 -0
- package/dist/cjs/plugins/images/index.js +164 -0
- package/dist/cjs/plugins/images/index.js.map +1 -0
- package/dist/cjs/plugins/images/utils.js +10 -0
- package/dist/cjs/plugins/images/utils.js.map +1 -0
- package/dist/cjs/plugins/link/auto-link.js +21 -0
- package/dist/cjs/plugins/link/auto-link.js.map +1 -0
- package/dist/cjs/plugins/link/convert-selection-on-paste.js +34 -0
- package/dist/cjs/plugins/link/convert-selection-on-paste.js.map +1 -0
- package/dist/cjs/plugins/link/link.js +68 -0
- package/dist/cjs/plugins/link/link.js.map +1 -0
- package/dist/cjs/plugins/mentions/index.js +108 -0
- package/dist/cjs/plugins/mentions/index.js.map +1 -0
- package/dist/cjs/plugins/tab-focus/index.js +54 -0
- package/dist/cjs/plugins/tab-focus/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/_virtual/_commonjsHelpers.js +8 -0
- package/dist/cjs/react-components/dist/es/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/cjs/react-components/dist/es/_virtual/index.js +6 -0
- package/dist/cjs/react-components/dist/es/_virtual/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/_virtual/index2.js +6 -0
- package/dist/cjs/react-components/dist/es/_virtual/index2.js.map +1 -0
- package/dist/cjs/react-components/dist/es/_virtual/react-is.development.js +6 -0
- package/dist/cjs/react-components/dist/es/_virtual/react-is.development.js.map +1 -0
- package/dist/cjs/react-components/dist/es/_virtual/react-is.production.min.js +6 -0
- package/dist/cjs/react-components/dist/es/_virtual/react-is.production.min.js.map +1 -0
- package/dist/cjs/react-components/dist/es/box/box.js +47 -0
- package/dist/cjs/react-components/dist/es/box/box.js.map +1 -0
- package/dist/cjs/react-components/dist/es/button/button.js +774 -0
- package/dist/cjs/react-components/dist/es/button/button.js.map +1 -0
- package/dist/cjs/react-components/dist/es/button/icon-button.js +77 -0
- package/dist/cjs/react-components/dist/es/button/icon-button.js.map +1 -0
- package/dist/cjs/react-components/dist/es/button/side-element.js +199 -0
- package/dist/cjs/react-components/dist/es/button/side-element.js.map +1 -0
- package/dist/cjs/react-components/dist/es/button/utils.js +105 -0
- package/dist/cjs/react-components/dist/es/button/utils.js.map +1 -0
- package/dist/cjs/react-components/dist/es/dialog/dialog.js +197 -0
- package/dist/cjs/react-components/dist/es/dialog/dialog.js.map +1 -0
- package/dist/cjs/react-components/dist/es/dropdown/dropdown.js +195 -0
- package/dist/cjs/react-components/dist/es/dropdown/dropdown.js.map +1 -0
- package/dist/cjs/react-components/dist/es/flex/flex.js +98 -0
- package/dist/cjs/react-components/dist/es/flex/flex.js.map +1 -0
- package/dist/cjs/react-components/dist/es/form-helper-text/form-helper-text.js +76 -0
- package/dist/cjs/react-components/dist/es/form-helper-text/form-helper-text.js.map +1 -0
- package/dist/cjs/react-components/dist/es/form-label/form-label.js +176 -0
- package/dist/cjs/react-components/dist/es/form-label/form-label.js.map +1 -0
- package/dist/cjs/react-components/dist/es/input/form-input.js +159 -0
- package/dist/cjs/react-components/dist/es/input/form-input.js.map +1 -0
- package/dist/cjs/react-components/dist/es/input/input.js +377 -0
- package/dist/cjs/react-components/dist/es/input/input.js.map +1 -0
- package/dist/cjs/react-components/dist/es/link/link.js +58 -0
- package/dist/cjs/react-components/dist/es/link/link.js.map +1 -0
- package/dist/cjs/react-components/dist/es/loader/circle.js +204 -0
- package/dist/cjs/react-components/dist/es/loader/circle.js.map +1 -0
- package/dist/cjs/react-components/dist/es/loader/line.js +130 -0
- package/dist/cjs/react-components/dist/es/loader/line.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/extends.js +21 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +14 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +19 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +14 -0
- package/dist/cjs/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +788 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +612 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +299 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +146 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +148 -0
- package/dist/cjs/react-components/dist/es/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/primitive/dist/index.js +14 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/primitive/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-arrow/dist/index.js +48 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-collection/dist/index.js +71 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-compose-refs/dist/index.js +41 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-context/dist/index.js +102 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-context/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js +354 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-direction/dist/index.js +33 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +234 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +303 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-focus-guards/dist/index.js +48 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-focus-scope/dist/index.js +229 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-id/dist/index.js +37 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-id/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-label/dist/index.js +47 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-label/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-menu/dist/index.js +847 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-menu/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-popper/dist/index.js +309 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-portal/dist/index.js +39 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-presence/dist/index.js +142 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-primitive/dist/index.js +65 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-roving-focus/dist/index.js +246 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-slot/dist/index.js +104 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-tooltip/dist/index.js +509 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-tooltip/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +34 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +68 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +40 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +29 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-size/dist/index.js +62 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-visually-hidden/dist/index.js +58 -0
- package/dist/cjs/react-components/dist/es/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/@stitches/react/dist/index.js +9 -0
- package/dist/cjs/react-components/dist/es/node_modules/@stitches/react/dist/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/aria-hidden/dist/es2015/index.js +134 -0
- package/dist/cjs/react-components/dist/es/node_modules/aria-hidden/dist/es2015/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/addClass.js +19 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/addClass.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/hasClass.js +17 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/hasClass.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/removeClass.js +27 -0
- package/dist/cjs/react-components/dist/es/node_modules/dom-helpers/esm/removeClass.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/get-nonce/dist/es2015/index.js +11 -0
- package/dist/cjs/react-components/dist/es/node_modules/get-nonce/dist/es2015/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/object-assign/index.js +102 -0
- package/dist/cjs/react-components/dist/es/node_modules/object-assign/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/checkPropTypes.js +118 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/checkPropTypes.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +77 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +628 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/index.js +35 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +24 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/lib/has.js +14 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/lib/has.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +193 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +29 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/index.js +22 -0
- package/dist/cjs/react-components/dist/es/node_modules/prop-types/node_modules/react-is/index.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/Combination.js +34 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +184 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/UI.js +60 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +24 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/medium.js +8 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/sidecar.js +12 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/component.js +80 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +16 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +35 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/component.js +22 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/hook.js +47 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/singleton.js +54 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/CSSTransition.js +419 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/CSSTransition.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/Transition.js +637 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/Transition.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/TransitionGroupContext.js +10 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/TransitionGroupContext.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/config.js +10 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/config.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/utils/PropTypes.js +25 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/utils/PropTypes.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/utils/reflow.js +8 -0
- package/dist/cjs/react-components/dist/es/node_modules/react-transition-group/esm/utils/reflow.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/tslib/tslib.es6.js +55 -0
- package/dist/cjs/react-components/dist/es/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/assignRef.js +27 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +25 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useRef.js +45 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-sidecar/dist/es2015/exports.js +43 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-sidecar/dist/es2015/medium.js +80 -0
- package/dist/cjs/react-components/dist/es/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
- package/dist/cjs/react-components/dist/es/packages/react-components/node_modules/clsx/dist/clsx.js +9 -0
- package/dist/cjs/react-components/dist/es/packages/react-components/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/cjs/react-components/dist/es/packages/react-icons/dist/es/icons/info.js +97 -0
- package/dist/cjs/react-components/dist/es/packages/react-icons/dist/es/icons/info.js.map +1 -0
- package/dist/cjs/react-components/dist/es/stitches.config.js +392 -0
- package/dist/cjs/react-components/dist/es/stitches.config.js.map +1 -0
- package/dist/cjs/react-components/dist/es/text/text.js +117 -0
- package/dist/cjs/react-components/dist/es/text/text.js.map +1 -0
- package/dist/cjs/react-components/dist/es/tooltip/tooltip.js +156 -0
- package/dist/cjs/react-components/dist/es/tooltip/tooltip.js.map +1 -0
- package/dist/cjs/react-components/dist/es/utils/prefix-class-name.js +10 -0
- package/dist/cjs/react-components/dist/es/utils/prefix-class-name.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/clsx/dist/clsx.js +9 -0
- package/dist/cjs/react-editor/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isFQDN.js +75 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isFQDN.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isIP.js +58 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isIP.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isURL.js +163 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/isURL.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/util/assertString.js +16 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/util/assertString.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/util/merge.js +17 -0
- package/dist/cjs/react-editor/node_modules/validator/es/lib/util/merge.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isFQDN.js +93 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isFQDN.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isIP.js +75 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isIP.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isURL.js +182 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/isURL.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/util/assertString.js +32 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/util/assertString.js.map +1 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/util/merge.js +33 -0
- package/dist/cjs/react-editor/node_modules/validator/lib/util/merge.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/bold.js +86 -0
- package/dist/cjs/react-icons/dist/es/icons/bold.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/close.js +86 -0
- package/dist/cjs/react-icons/dist/es/icons/close.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/code-block.js +78 -0
- package/dist/cjs/react-icons/dist/es/icons/code-block.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/code.js +96 -0
- package/dist/cjs/react-icons/dist/es/icons/code.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/delete.js +116 -0
- package/dist/cjs/react-icons/dist/es/icons/delete.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/italics.js +96 -0
- package/dist/cjs/react-icons/dist/es/icons/italics.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/link.js +86 -0
- package/dist/cjs/react-icons/dist/es/icons/link.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/ordered-list.js +86 -0
- package/dist/cjs/react-icons/dist/es/icons/ordered-list.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/pencil.js +86 -0
- package/dist/cjs/react-icons/dist/es/icons/pencil.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-center.js +74 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-center.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-justify.js +74 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-justify.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-left.js +74 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-left.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-right.js +74 -0
- package/dist/cjs/react-icons/dist/es/icons/text-align-right.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/text-format.js +78 -0
- package/dist/cjs/react-icons/dist/es/icons/text-format.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/underline.js +77 -0
- package/dist/cjs/react-icons/dist/es/icons/underline.js.map +1 -0
- package/dist/cjs/react-icons/dist/es/icons/unordered-list.js +126 -0
- package/dist/cjs/react-icons/dist/es/icons/unordered-list.js.map +1 -0
- package/dist/cjs/utils/commands.js +8 -0
- package/dist/cjs/utils/commands.js.map +1 -0
- package/dist/cjs/utils/get-dom-range-rect.js +19 -0
- package/dist/cjs/utils/get-dom-range-rect.js.map +1 -0
- package/dist/cjs/utils/get-selected-node.js +21 -0
- package/dist/cjs/utils/get-selected-node.js.map +1 -0
- package/dist/cjs/utils/prefix-class-name.js +10 -0
- package/dist/cjs/utils/prefix-class-name.js.map +1 -0
- package/dist/cjs/utils/set-floating-elem-position-for-link-editor.js +30 -0
- package/dist/cjs/utils/set-floating-elem-position-for-link-editor.js.map +1 -0
- package/dist/cjs/utils/set-floating-elem-position.js +33 -0
- package/dist/cjs/utils/set-floating-elem-position.js.map +1 -0
- package/dist/cjs/utils/use-node-focus.js +35 -0
- package/dist/cjs/utils/use-node-focus.js.map +1 -0
- package/dist/es/_virtual/_commonjsHelpers.js +6 -0
- package/dist/es/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/es/_virtual/assertString.js +4 -0
- package/dist/es/_virtual/assertString.js.map +1 -0
- package/dist/es/_virtual/isFQDN.js +4 -0
- package/dist/es/_virtual/isFQDN.js.map +1 -0
- package/dist/es/_virtual/isIP.js +4 -0
- package/dist/es/_virtual/isIP.js.map +1 -0
- package/dist/es/_virtual/isURL.js +8 -0
- package/dist/es/_virtual/isURL.js.map +1 -0
- package/dist/es/_virtual/isURL2.js +4 -0
- package/dist/es/_virtual/isURL2.js.map +1 -0
- package/dist/es/_virtual/merge.js +4 -0
- package/dist/es/_virtual/merge.js.map +1 -0
- package/dist/es/components/base-dropdown/index.js +173 -0
- package/dist/es/components/base-dropdown/index.js.map +1 -0
- package/dist/es/components/dialog-link-editor/index.js +289 -0
- package/dist/es/components/dialog-link-editor/index.js.map +1 -0
- package/dist/es/components/dialog-link-editor/link-editor-dialog.js +197 -0
- package/dist/es/components/dialog-link-editor/link-editor-dialog.js.map +1 -0
- package/dist/es/components/dialog-link-editor/link-tooltip.js +120 -0
- package/dist/es/components/dialog-link-editor/link-tooltip.js.map +1 -0
- package/dist/es/components/floating-toolbar/floating-toolbar.js +300 -0
- package/dist/es/components/floating-toolbar/floating-toolbar.js.map +1 -0
- package/dist/es/components/rich-editor/index.js +140 -0
- package/dist/es/components/rich-editor/index.js.map +1 -0
- package/dist/es/components/toolbar/toolbar.js +74 -0
- package/dist/es/components/toolbar/toolbar.js.map +1 -0
- package/dist/es/components/toolbar/tools/bold.js +50 -0
- package/dist/es/components/toolbar/tools/bold.js.map +1 -0
- package/dist/es/components/toolbar/tools/code-block.js +77 -0
- package/dist/es/components/toolbar/tools/code-block.js.map +1 -0
- package/dist/es/components/toolbar/tools/code.js +52 -0
- package/dist/es/components/toolbar/tools/code.js.map +1 -0
- package/dist/es/components/toolbar/tools/commons.js +14 -0
- package/dist/es/components/toolbar/tools/commons.js.map +1 -0
- package/dist/es/components/toolbar/tools/format.js +134 -0
- package/dist/es/components/toolbar/tools/format.js.map +1 -0
- package/dist/es/components/toolbar/tools/italic.js +55 -0
- package/dist/es/components/toolbar/tools/italic.js.map +1 -0
- package/dist/es/components/toolbar/tools/link.js +69 -0
- package/dist/es/components/toolbar/tools/link.js.map +1 -0
- package/dist/es/components/toolbar/tools/ordered-list.js +60 -0
- package/dist/es/components/toolbar/tools/ordered-list.js.map +1 -0
- package/dist/es/components/toolbar/tools/text-align.js +80 -0
- package/dist/es/components/toolbar/tools/text-align.js.map +1 -0
- package/dist/es/components/toolbar/tools/underline.js +55 -0
- package/dist/es/components/toolbar/tools/underline.js.map +1 -0
- package/dist/es/components/toolbar/tools/unordered-list.js +60 -0
- package/dist/es/components/toolbar/tools/unordered-list.js.map +1 -0
- package/dist/es/components/toolbar-context/context.js +145 -0
- package/dist/es/components/toolbar-context/context.js.map +1 -0
- package/dist/es/components/toolbar-context/store.js +72 -0
- package/dist/es/components/toolbar-context/store.js.map +1 -0
- package/dist/es/components/toolbar-context/utils.js +4 -0
- package/dist/es/components/toolbar-context/utils.js.map +1 -0
- package/dist/es/editor.js +152 -0
- package/dist/es/editor.js.map +1 -0
- package/dist/es/index.js +34 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/nodes/emoji.js +82 -0
- package/dist/es/nodes/emoji.js.map +1 -0
- package/dist/es/nodes/hashtag.js +105 -0
- package/dist/es/nodes/hashtag.js.map +1 -0
- package/dist/es/nodes/image.js +211 -0
- package/dist/es/nodes/image.js.map +1 -0
- package/dist/es/nodes/kudos.js +106 -0
- package/dist/es/nodes/kudos.js.map +1 -0
- package/dist/es/nodes/mention.js +105 -0
- package/dist/es/nodes/mention.js.map +1 -0
- package/dist/es/nodes/variables.js +105 -0
- package/dist/es/nodes/variables.js.map +1 -0
- package/dist/es/plugins/data-management-plugin/index.js +38 -0
- package/dist/es/plugins/data-management-plugin/index.js.map +1 -0
- package/dist/es/plugins/emoji/emoji-list.js +16605 -0
- package/dist/es/plugins/emoji/emoji-list.js.map +1 -0
- package/dist/es/plugins/emoji/index.js +124 -0
- package/dist/es/plugins/emoji/index.js.map +1 -0
- package/dist/es/plugins/hashtag/index.js +98 -0
- package/dist/es/plugins/hashtag/index.js.map +1 -0
- package/dist/es/plugins/images/index.js +162 -0
- package/dist/es/plugins/images/index.js.map +1 -0
- package/dist/es/plugins/images/utils.js +7 -0
- package/dist/es/plugins/images/utils.js.map +1 -0
- package/dist/es/plugins/link/auto-link.js +19 -0
- package/dist/es/plugins/link/auto-link.js.map +1 -0
- package/dist/es/plugins/link/convert-selection-on-paste.js +32 -0
- package/dist/es/plugins/link/convert-selection-on-paste.js.map +1 -0
- package/dist/es/plugins/link/link.js +66 -0
- package/dist/es/plugins/link/link.js.map +1 -0
- package/dist/es/plugins/mentions/index.js +106 -0
- package/dist/es/plugins/mentions/index.js.map +1 -0
- package/dist/es/plugins/tab-focus/index.js +52 -0
- package/dist/es/plugins/tab-focus/index.js.map +1 -0
- package/dist/es/react-components/dist/es/_virtual/_commonjsHelpers.js +6 -0
- package/dist/es/react-components/dist/es/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/es/react-components/dist/es/_virtual/index.js +4 -0
- package/dist/es/react-components/dist/es/_virtual/index.js.map +1 -0
- package/dist/es/react-components/dist/es/_virtual/index2.js +4 -0
- package/dist/es/react-components/dist/es/_virtual/index2.js.map +1 -0
- package/dist/es/react-components/dist/es/_virtual/react-is.development.js +4 -0
- package/dist/es/react-components/dist/es/_virtual/react-is.development.js.map +1 -0
- package/dist/es/react-components/dist/es/_virtual/react-is.production.min.js +4 -0
- package/dist/es/react-components/dist/es/_virtual/react-is.production.min.js.map +1 -0
- package/dist/es/react-components/dist/es/box/box.js +45 -0
- package/dist/es/react-components/dist/es/box/box.js.map +1 -0
- package/dist/es/react-components/dist/es/button/button.js +772 -0
- package/dist/es/react-components/dist/es/button/button.js.map +1 -0
- package/dist/es/react-components/dist/es/button/icon-button.js +75 -0
- package/dist/es/react-components/dist/es/button/icon-button.js.map +1 -0
- package/dist/es/react-components/dist/es/button/side-element.js +197 -0
- package/dist/es/react-components/dist/es/button/side-element.js.map +1 -0
- package/dist/es/react-components/dist/es/button/utils.js +100 -0
- package/dist/es/react-components/dist/es/button/utils.js.map +1 -0
- package/dist/es/react-components/dist/es/dialog/dialog.js +193 -0
- package/dist/es/react-components/dist/es/dialog/dialog.js.map +1 -0
- package/dist/es/react-components/dist/es/dropdown/dropdown.js +190 -0
- package/dist/es/react-components/dist/es/dropdown/dropdown.js.map +1 -0
- package/dist/es/react-components/dist/es/flex/flex.js +96 -0
- package/dist/es/react-components/dist/es/flex/flex.js.map +1 -0
- package/dist/es/react-components/dist/es/form-helper-text/form-helper-text.js +74 -0
- package/dist/es/react-components/dist/es/form-helper-text/form-helper-text.js.map +1 -0
- package/dist/es/react-components/dist/es/form-label/form-label.js +174 -0
- package/dist/es/react-components/dist/es/form-label/form-label.js.map +1 -0
- package/dist/es/react-components/dist/es/input/form-input.js +157 -0
- package/dist/es/react-components/dist/es/input/form-input.js.map +1 -0
- package/dist/es/react-components/dist/es/input/input.js +374 -0
- package/dist/es/react-components/dist/es/input/input.js.map +1 -0
- package/dist/es/react-components/dist/es/link/link.js +56 -0
- package/dist/es/react-components/dist/es/link/link.js.map +1 -0
- package/dist/es/react-components/dist/es/loader/circle.js +202 -0
- package/dist/es/react-components/dist/es/loader/circle.js.map +1 -0
- package/dist/es/react-components/dist/es/loader/line.js +128 -0
- package/dist/es/react-components/dist/es/loader/line.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/extends.js +17 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +10 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +15 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +10 -0
- package/dist/es/react-components/dist/es/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +777 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +600 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +269 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +123 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +129 -0
- package/dist/es/react-components/dist/es/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/primitive/dist/index.js +12 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/primitive/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-arrow/dist/index.js +26 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-collection/dist/index.js +69 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-compose-refs/dist/index.js +19 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-context/dist/index.js +80 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-context/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js +318 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-direction/dist/index.js +12 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +212 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +254 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-focus-guards/dist/index.js +27 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-focus-scope/dist/index.js +208 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-id/dist/index.js +16 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-id/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-label/dist/index.js +25 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-label/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-menu/dist/index.js +796 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-menu/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-popper/dist/index.js +280 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-portal/dist/index.js +18 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-presence/dist/index.js +120 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-roving-focus/dist/index.js +221 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-slot/dist/index.js +82 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-tooltip/dist/index.js +476 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-tooltip/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +47 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +19 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +8 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-size/dist/index.js +41 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-visually-hidden/dist/index.js +36 -0
- package/dist/es/react-components/dist/es/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/@stitches/react/dist/index.js +6 -0
- package/dist/es/react-components/dist/es/node_modules/@stitches/react/dist/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/aria-hidden/dist/es2015/index.js +132 -0
- package/dist/es/react-components/dist/es/node_modules/aria-hidden/dist/es2015/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/addClass.js +15 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/addClass.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/hasClass.js +13 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/hasClass.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/removeClass.js +23 -0
- package/dist/es/react-components/dist/es/node_modules/dom-helpers/esm/removeClass.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/get-nonce/dist/es2015/index.js +9 -0
- package/dist/es/react-components/dist/es/node_modules/get-nonce/dist/es2015/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/object-assign/index.js +100 -0
- package/dist/es/react-components/dist/es/node_modules/object-assign/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/checkPropTypes.js +116 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/checkPropTypes.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +75 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +626 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/index.js +31 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +22 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/lib/has.js +12 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/lib/has.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +191 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +27 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/index.js +20 -0
- package/dist/es/react-components/dist/es/node_modules/prop-types/node_modules/react-is/index.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +161 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/UI.js +39 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +22 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +107 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/medium.js +6 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/sidecar.js +8 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/component.js +57 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +11 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +32 -0
- package/dist/es/react-components/dist/es/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/component.js +20 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/hook.js +26 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/singleton.js +52 -0
- package/dist/es/react-components/dist/es/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/CSSTransition.js +415 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/CSSTransition.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/Transition.js +628 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/Transition.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/TransitionGroupContext.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/config.js +6 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/config.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/utils/PropTypes.js +22 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/utils/PropTypes.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/utils/reflow.js +6 -0
- package/dist/es/react-components/dist/es/node_modules/react-transition-group/esm/utils/reflow.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/tslib/tslib.es6.js +52 -0
- package/dist/es/react-components/dist/es/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/assignRef.js +25 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +23 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useRef.js +43 -0
- package/dist/es/react-components/dist/es/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/use-sidecar/dist/es2015/exports.js +22 -0
- package/dist/es/react-components/dist/es/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -0
- package/dist/es/react-components/dist/es/node_modules/use-sidecar/dist/es2015/medium.js +78 -0
- package/dist/es/react-components/dist/es/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
- package/dist/es/react-components/dist/es/packages/react-components/node_modules/clsx/dist/clsx.js +4 -0
- package/dist/es/react-components/dist/es/packages/react-components/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/es/react-components/dist/es/packages/react-icons/dist/es/icons/info.js +95 -0
- package/dist/es/react-components/dist/es/packages/react-icons/dist/es/icons/info.js.map +1 -0
- package/dist/es/react-components/dist/es/stitches.config.js +379 -0
- package/dist/es/react-components/dist/es/stitches.config.js.map +1 -0
- package/dist/es/react-components/dist/es/text/text.js +115 -0
- package/dist/es/react-components/dist/es/text/text.js.map +1 -0
- package/dist/es/react-components/dist/es/tooltip/tooltip.js +153 -0
- package/dist/es/react-components/dist/es/tooltip/tooltip.js.map +1 -0
- package/dist/es/react-components/dist/es/utils/prefix-class-name.js +8 -0
- package/dist/es/react-components/dist/es/utils/prefix-class-name.js.map +1 -0
- package/dist/es/react-editor/node_modules/clsx/dist/clsx.js +4 -0
- package/dist/es/react-editor/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isFQDN.js +71 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isFQDN.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isIP.js +54 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isIP.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isURL.js +159 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/isURL.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/util/assertString.js +12 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/util/assertString.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/util/merge.js +13 -0
- package/dist/es/react-editor/node_modules/validator/es/lib/util/merge.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/lib/isFQDN.js +91 -0
- package/dist/es/react-editor/node_modules/validator/lib/isFQDN.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/lib/isIP.js +73 -0
- package/dist/es/react-editor/node_modules/validator/lib/isIP.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/lib/isURL.js +180 -0
- package/dist/es/react-editor/node_modules/validator/lib/isURL.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/lib/util/assertString.js +30 -0
- package/dist/es/react-editor/node_modules/validator/lib/util/assertString.js.map +1 -0
- package/dist/es/react-editor/node_modules/validator/lib/util/merge.js +31 -0
- package/dist/es/react-editor/node_modules/validator/lib/util/merge.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/bold.js +84 -0
- package/dist/es/react-icons/dist/es/icons/bold.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/close.js +84 -0
- package/dist/es/react-icons/dist/es/icons/close.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/code-block.js +76 -0
- package/dist/es/react-icons/dist/es/icons/code-block.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/code.js +94 -0
- package/dist/es/react-icons/dist/es/icons/code.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/delete.js +114 -0
- package/dist/es/react-icons/dist/es/icons/delete.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/italics.js +94 -0
- package/dist/es/react-icons/dist/es/icons/italics.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/link.js +84 -0
- package/dist/es/react-icons/dist/es/icons/link.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/ordered-list.js +84 -0
- package/dist/es/react-icons/dist/es/icons/ordered-list.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/pencil.js +84 -0
- package/dist/es/react-icons/dist/es/icons/pencil.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/text-align-center.js +72 -0
- package/dist/es/react-icons/dist/es/icons/text-align-center.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/text-align-justify.js +72 -0
- package/dist/es/react-icons/dist/es/icons/text-align-justify.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/text-align-left.js +72 -0
- package/dist/es/react-icons/dist/es/icons/text-align-left.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/text-align-right.js +72 -0
- package/dist/es/react-icons/dist/es/icons/text-align-right.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/text-format.js +76 -0
- package/dist/es/react-icons/dist/es/icons/text-format.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/underline.js +75 -0
- package/dist/es/react-icons/dist/es/icons/underline.js.map +1 -0
- package/dist/es/react-icons/dist/es/icons/unordered-list.js +124 -0
- package/dist/es/react-icons/dist/es/icons/unordered-list.js.map +1 -0
- package/dist/es/utils/commands.js +6 -0
- package/dist/es/utils/commands.js.map +1 -0
- package/dist/es/utils/get-dom-range-rect.js +17 -0
- package/dist/es/utils/get-dom-range-rect.js.map +1 -0
- package/dist/es/utils/get-selected-node.js +19 -0
- package/dist/es/utils/get-selected-node.js.map +1 -0
- package/dist/es/utils/prefix-class-name.js +8 -0
- package/dist/es/utils/prefix-class-name.js.map +1 -0
- package/dist/es/utils/set-floating-elem-position-for-link-editor.js +28 -0
- package/dist/es/utils/set-floating-elem-position-for-link-editor.js.map +1 -0
- package/dist/es/utils/set-floating-elem-position.js +31 -0
- package/dist/es/utils/set-floating-elem-position.js.map +1 -0
- package/dist/es/utils/use-node-focus.js +33 -0
- package/dist/es/utils/use-node-focus.js.map +1 -0
- package/dist/index.d.ts +445 -0
- package/package.json +151 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"floating-toolbar.js","sources":["../../../../src/components/floating-toolbar/floating-toolbar.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { mergeRegister } from '@lexical/utils';\nimport { Box, BoxProps, Flex } from '@sparrowengg/twigs-react';\nimport {\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n LexicalEditor,\n SELECTION_CHANGE_COMMAND\n} from 'lexical';\nimport React, {\n Fragment,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { getDOMRangeRect } from '@src/utils/get-dom-range-rect';\nimport { getSelectedNode } from '@src/utils/get-selected-node';\nimport { setFloatingElemPosition } from '@src/utils/set-floating-elem-position';\nimport { prefixClassName } from '@src/utils/prefix-class-name';\nimport { DefaultToolbarTools } from '../toolbar/toolbar';\nimport {\n BoldTool,\n ItalicTool,\n LinkTool,\n UnderlineTool\n} from '../toolbar/tools';\n\ntype DefaultFloatingToolbarTools = Extract<\n DefaultToolbarTools,\n | 'bold'\n | 'italic'\n | 'underline'\n | 'link'\n | 'strikethrough'\n | 'subscript'\n | 'superscript'\n>;\n\ntype ToolProps = { editor: LexicalEditor };\n\ntype CustomTool = {\n renderComponent: (props: ToolProps) => ReactNode;\n};\n\nexport type FloatingToolbarTools = (DefaultFloatingToolbarTools | CustomTool)[];\n\nconst defaultTools: DefaultFloatingToolbarTools[] = [\n 'bold',\n 'italic',\n 'underline',\n 'link'\n];\n\nconst toolMapping = {\n bold: BoldTool,\n italic: ItalicTool,\n underline: UnderlineTool,\n link: LinkTool\n};\n\nexport type FloatingToolbarProperties = {\n isBold: boolean;\n isItalic: boolean;\n isUnderline: boolean;\n isLink: boolean;\n isStrikethrough: boolean;\n isSubscript: boolean;\n isSuperscript: boolean;\n};\n\nconst FloatingToolbarContainer = ({\n editor,\n anchorElem,\n children,\n tools = defaultTools,\n containerProps\n}: {\n editor: LexicalEditor;\n anchorElem: HTMLElement;\n children?: ReactNode;\n tools?: FloatingToolbarTools;\n containerProps?: BoxProps;\n}): React.JSX.Element => {\n const popupCharStylesEditorRef = useRef<HTMLDivElement | null>(null);\n\n function mouseMoveListener(e: MouseEvent) {\n if (\n popupCharStylesEditorRef?.current\n && (e.buttons === 1 || e.buttons === 3)\n ) {\n if (popupCharStylesEditorRef.current.style.pointerEvents !== 'none') {\n const x = e.clientX;\n const y = e.clientY;\n const elementUnderMouse = document.elementFromPoint(x, y);\n\n if (!popupCharStylesEditorRef.current.contains(elementUnderMouse)) {\n // Mouse is not over the target element => not a normal click, but probably a drag\n popupCharStylesEditorRef.current.style.pointerEvents = 'none';\n }\n }\n }\n }\n function mouseUpListener() {\n if (popupCharStylesEditorRef?.current) {\n if (popupCharStylesEditorRef.current.style.pointerEvents !== 'auto') {\n popupCharStylesEditorRef.current.style.pointerEvents = 'auto';\n }\n }\n }\n\n // eslint-disable-next-line consistent-return\n useEffect(() => {\n if (popupCharStylesEditorRef?.current) {\n document.addEventListener('mousemove', mouseMoveListener);\n document.addEventListener('mouseup', mouseUpListener);\n\n return () => {\n document.removeEventListener('mousemove', mouseMoveListener);\n document.removeEventListener('mouseup', mouseUpListener);\n };\n }\n }, [popupCharStylesEditorRef]);\n\n const updateFloatingToolbar = useCallback(() => {\n const selection = $getSelection();\n\n const popupCharStylesEditorElem = popupCharStylesEditorRef.current;\n const nativeSelection = window.getSelection();\n\n if (popupCharStylesEditorElem === null) {\n return;\n }\n\n const rootElement = editor.getRootElement();\n if (\n selection !== null\n && nativeSelection !== null\n && !nativeSelection.isCollapsed\n && rootElement !== null\n && rootElement.contains(nativeSelection.anchorNode)\n ) {\n const rangeRect = getDOMRangeRect(nativeSelection, rootElement);\n\n setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);\n }\n }, [editor, anchorElem]);\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement;\n\n const update = () => {\n editor.getEditorState().read(() => {\n updateFloatingToolbar();\n });\n };\n\n window.addEventListener('resize', update);\n if (scrollerElem) {\n scrollerElem.addEventListener('scroll', update);\n }\n\n return () => {\n window.removeEventListener('resize', update);\n if (scrollerElem) {\n scrollerElem.removeEventListener('scroll', update);\n }\n };\n }, [editor, updateFloatingToolbar, anchorElem]);\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n updateFloatingToolbar();\n });\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateFloatingToolbar();\n });\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n updateFloatingToolbar();\n return false;\n },\n COMMAND_PRIORITY_LOW\n )\n );\n }, [editor, updateFloatingToolbar]);\n\n return (\n <Box\n ref={popupCharStylesEditorRef}\n className={prefixClassName('floating-toolbar')}\n {...containerProps}\n css={{\n position: 'absolute',\n left: 0,\n top: 0,\n backgroundColor: '$black900',\n borderRadius: '$md',\n display: 'flex',\n\n '&::after': {\n content: '',\n position: 'absolute',\n top: '-8px',\n left: '8px',\n width: '0',\n height: '0',\n borderLeft: '8px solid transparent',\n borderRight: '8px solid transparent',\n borderBottom: '8px solid $black900'\n },\n\n '&.position--top::after': {\n top: 'auto',\n bottom: '-8px',\n borderBottom: 'none',\n borderTop: '8px solid $black900'\n },\n ...containerProps?.css\n }}\n >\n {children ? (\n <>{children}</>\n ) : (\n <Flex\n alignItems=\"center\"\n css={{\n padding: '$2',\n gap: '$1',\n '.twigs-editor-tool-button': {\n backgroundColor: 'transparent',\n color: '$neutral100',\n\n '&:hover': {\n backgroundColorOpacity: ['$white100', 0.2],\n color: '$neutral100'\n },\n\n '&--active': {\n backgroundColorOpacity: ['$white100', 0.3]\n }\n }\n }}\n >\n {tools.map((_item, i) => {\n // @ts-ignore\n if (typeof _item === 'object' && _item.renderComponent) {\n const item = _item as CustomTool;\n return (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{item.renderComponent({ editor })}</Fragment>\n );\n }\n\n const item = _item as DefaultFloatingToolbarTools;\n const Tool = toolMapping[item];\n if (!Tool) return null;\n\n return (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>\n <Tool />\n </Fragment>\n );\n })}\n </Flex>\n )}\n </Box>\n );\n};\n\nfunction useFloatingTextFormatToolbar({\n editor,\n anchorElem,\n children,\n tools,\n containerProps\n}: {\n editor: LexicalEditor;\n anchorElem: HTMLElement;\n tools?: (DefaultFloatingToolbarTools | CustomTool)[];\n children?: ReactNode;\n containerProps?: BoxProps;\n}) {\n const [isText, setIsText] = useState(false);\n\n const updatePopup = useCallback(() => {\n editor.getEditorState().read(() => {\n // Should not to pop up the floating toolbar when using IME input\n if (editor.isComposing()) {\n return;\n }\n const selection = $getSelection();\n const nativeSelection = window.getSelection();\n const rootElement = editor.getRootElement();\n\n if (\n nativeSelection !== null\n && (!$isRangeSelection(selection)\n || rootElement === null\n || !rootElement.contains(nativeSelection.anchorNode))\n ) {\n setIsText(false);\n return;\n }\n\n if (!$isRangeSelection(selection)) {\n return;\n }\n const node = getSelectedNode(selection);\n\n if (selection.getTextContent() !== '') {\n setIsText($isTextNode(node) || $isParagraphNode(node));\n } else {\n setIsText(false);\n }\n\n const rawTextContent = selection.getTextContent().replace(/\\n/g, '');\n if (!selection.isCollapsed() && rawTextContent === '') {\n setIsText(false);\n }\n });\n }, [editor]);\n\n useEffect(() => {\n document.addEventListener('selectionchange', updatePopup);\n return () => {\n document.removeEventListener('selectionchange', updatePopup);\n };\n }, [updatePopup]);\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updatePopup();\n }),\n editor.registerRootListener(() => {\n if (editor.getRootElement() === null) {\n setIsText(false);\n }\n })\n );\n }, [editor, updatePopup]);\n\n if (!isText || !anchorElem) {\n return null;\n }\n\n return createPortal(\n <FloatingToolbarContainer\n editor={editor}\n anchorElem={anchorElem}\n tools={tools}\n containerProps={containerProps}\n >\n {children}\n </FloatingToolbarContainer>,\n anchorElem\n );\n}\n\nexport const EditorFloatingToolbar = ({\n anchorElem = document.body,\n tools,\n children,\n containerProps\n}: {\n anchorElem?: HTMLElement;\n tools?: (DefaultFloatingToolbarTools | CustomTool)[];\n children?: ReactNode;\n containerProps?: BoxProps;\n}) => {\n const [editor] = useLexicalComposerContext();\n return useFloatingTextFormatToolbar({\n editor,\n anchorElem,\n tools,\n children,\n containerProps\n });\n};\n"],"names":["item","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,YAA8C,GAAA;AAAA,EAClD,MAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAA;AAEA,MAAM,WAAc,GAAA;AAAA,EAClB,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA,UAAA;AAAA,EACR,SAAW,EAAA,aAAA;AAAA,EACX,IAAM,EAAA;AACR,CAAA;AAYA,MAAM,2BAA2B,CAAC;AAAA,EAChC,MAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAQ,GAAA,YAAA;AAAA,EACR;AACF,CAMyB,KAAA;AACvB,EAAM,MAAA,wBAAA,GAA2B,OAA8B,IAAI,CAAA;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J,EAAM,MAAA,CAAC,MAAM,CAAA,GAAI,yBAA0B,EAAA;AAC3C,EAAA,OAAO,4BAA6B,CAAA;AAAA,IAClC,MAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;;;;"}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
2
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
3
|
+
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
4
|
+
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
5
|
+
import { isValidElement } from 'react';
|
6
|
+
import { Box } from '../../react-components/dist/es/box/box.js';
|
7
|
+
|
8
|
+
var __defProp = Object.defineProperty;
|
9
|
+
var __defProps = Object.defineProperties;
|
10
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
11
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
15
|
+
var __spreadValues = (a, b) => {
|
16
|
+
for (var prop in b || (b = {}))
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
19
|
+
if (__getOwnPropSymbols)
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
21
|
+
if (__propIsEnum.call(b, prop))
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
23
|
+
}
|
24
|
+
return a;
|
25
|
+
};
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
27
|
+
const RichEditor = ({
|
28
|
+
containerRef,
|
29
|
+
placeholder,
|
30
|
+
editorContainerProps
|
31
|
+
}) => {
|
32
|
+
return /* @__PURE__ */ jsx(
|
33
|
+
Box,
|
34
|
+
__spreadProps(__spreadValues({}, editorContainerProps), {
|
35
|
+
css: __spreadValues({
|
36
|
+
position: "relative"
|
37
|
+
}, editorContainerProps == null ? void 0 : editorContainerProps.css),
|
38
|
+
children: /* @__PURE__ */ jsx(
|
39
|
+
RichTextPlugin,
|
40
|
+
{
|
41
|
+
contentEditable: /* @__PURE__ */ jsx(Box, { className: "editor-container", children: /* @__PURE__ */ jsx(
|
42
|
+
Box,
|
43
|
+
{
|
44
|
+
className: "editor",
|
45
|
+
css: {
|
46
|
+
position: "relative",
|
47
|
+
borderRadius: "$md",
|
48
|
+
border: "1px solid $neutral200",
|
49
|
+
textAlign: "left",
|
50
|
+
"& .text-bold": {
|
51
|
+
fontWeight: "bold"
|
52
|
+
},
|
53
|
+
"& .text-italic": {
|
54
|
+
fontStyle: "italic"
|
55
|
+
},
|
56
|
+
"& .text-underline": {
|
57
|
+
textDecoration: "underline"
|
58
|
+
},
|
59
|
+
p: {
|
60
|
+
margin: "$1 0"
|
61
|
+
},
|
62
|
+
ul: {
|
63
|
+
listStyle: "disc",
|
64
|
+
marginLeft: "$7",
|
65
|
+
ul: {
|
66
|
+
listStyle: "circle"
|
67
|
+
}
|
68
|
+
},
|
69
|
+
ol: {
|
70
|
+
listStyle: "decimal",
|
71
|
+
marginLeft: "$7",
|
72
|
+
ol: {
|
73
|
+
listStyle: "lower-alpha"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
".text-code": {
|
77
|
+
color: "#F97316",
|
78
|
+
padding: "0 $2",
|
79
|
+
backgroundColor: "$neutral100",
|
80
|
+
border: "1px solid $neutral200",
|
81
|
+
borderRadius: "$sm",
|
82
|
+
"&, & *": {
|
83
|
+
fontFamily: "monospace"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
".block-code": {
|
87
|
+
padding: "$4",
|
88
|
+
display: "block",
|
89
|
+
color: "$neutral900",
|
90
|
+
backgroundColor: "$neutral100",
|
91
|
+
border: "1px solid $neutral200",
|
92
|
+
borderRadius: "$md",
|
93
|
+
"&, & *": {
|
94
|
+
fontFamily: "monospace"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
".block-h1": {
|
98
|
+
fontSize: "$xl"
|
99
|
+
},
|
100
|
+
".block-h2": {
|
101
|
+
fontSize: "$lg"
|
102
|
+
},
|
103
|
+
".block-h3, .block-h4, .block-h5, .block-h6": {
|
104
|
+
fontSize: "$md"
|
105
|
+
}
|
106
|
+
},
|
107
|
+
ref: containerRef,
|
108
|
+
children: /* @__PURE__ */ jsx(
|
109
|
+
ContentEditable,
|
110
|
+
{
|
111
|
+
style: {
|
112
|
+
minHeight: "120px",
|
113
|
+
padding: "12px"
|
114
|
+
}
|
115
|
+
}
|
116
|
+
)
|
117
|
+
}
|
118
|
+
) }),
|
119
|
+
ErrorBoundary: LexicalErrorBoundary,
|
120
|
+
placeholder: !isValidElement(placeholder) ? /* @__PURE__ */ jsx(
|
121
|
+
Box,
|
122
|
+
{
|
123
|
+
css: {
|
124
|
+
position: "absolute",
|
125
|
+
top: "12px",
|
126
|
+
left: "12px",
|
127
|
+
color: "$black500",
|
128
|
+
pointerEvents: "none"
|
129
|
+
},
|
130
|
+
children: placeholder
|
131
|
+
}
|
132
|
+
) : placeholder
|
133
|
+
}
|
134
|
+
)
|
135
|
+
})
|
136
|
+
);
|
137
|
+
};
|
138
|
+
|
139
|
+
export { RichEditor };
|
140
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/rich-editor/index.tsx"],"sourcesContent":["import { ContentEditable } from '@lexical/react/LexicalContentEditable';\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';\nimport { ReactNode, RefObject, isValidElement } from 'react';\nimport { Box, BoxProps } from '@sparrowengg/twigs-react';\n\nexport const RichEditor = ({\n containerRef,\n placeholder,\n editorContainerProps\n}: {\n containerRef?:\n | ((instance: HTMLDivElement | null) => void)\n | RefObject<HTMLDivElement>;\n placeholder?: ReactNode | string;\n editorContainerProps?: BoxProps;\n}) => {\n return (\n <Box\n {...editorContainerProps}\n css={{\n position: 'relative',\n ...editorContainerProps?.css\n }}\n >\n <RichTextPlugin\n contentEditable={(\n <Box className=\"editor-container\">\n <Box\n className=\"editor\"\n css={{\n position: 'relative',\n borderRadius: '$md',\n border: '1px solid $neutral200',\n textAlign: 'left',\n\n '& .text-bold': {\n fontWeight: 'bold'\n },\n '& .text-italic': {\n fontStyle: 'italic'\n },\n '& .text-underline': {\n textDecoration: 'underline'\n },\n p: {\n margin: '$1 0'\n },\n ul: {\n listStyle: 'disc',\n marginLeft: '$7',\n\n ul: {\n listStyle: 'circle'\n }\n },\n ol: {\n listStyle: 'decimal',\n marginLeft: '$7',\n\n ol: {\n listStyle: 'lower-alpha'\n }\n },\n '.text-code': {\n color: '#F97316',\n padding: '0 $2',\n backgroundColor: '$neutral100',\n border: '1px solid $neutral200',\n borderRadius: '$sm',\n\n '&, & *': {\n fontFamily: 'monospace'\n }\n },\n '.block-code': {\n padding: '$4',\n display: 'block',\n color: '$neutral900',\n backgroundColor: '$neutral100',\n border: '1px solid $neutral200',\n borderRadius: '$md',\n\n '&, & *': {\n fontFamily: 'monospace'\n }\n },\n '.block-h1': {\n fontSize: '$xl'\n },\n '.block-h2': {\n fontSize: '$lg'\n },\n '.block-h3, .block-h4, .block-h5, .block-h6': {\n fontSize: '$md'\n }\n }}\n ref={containerRef}\n >\n <ContentEditable\n style={{\n minHeight: '120px',\n padding: '12px'\n }}\n />\n </Box>\n </Box>\n )}\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={\n !isValidElement(placeholder) ? (\n <Box\n css={{\n position: 'absolute',\n top: '12px',\n left: '12px',\n color: '$black500',\n pointerEvents: 'none'\n }}\n >\n {placeholder}\n </Box>\n ) : (\n placeholder\n )\n }\n />\n </Box>\n );\n};\n"],"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AA;AAAA,gBACN,KAAO,EAAA,WAAA;AAAA,gBACP,aAAe,EAAA;AAAA,eACjB;AAAA,cAEC,QAAA,EAAA;AAAA;AAAA,WAGH,GAAA;AAAA;AAAA;AAGN,KAAA;AAAA,GACF;AAEJ;;;;"}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
3
|
+
import { prefixClassName } from '../../utils/prefix-class-name.js';
|
4
|
+
import { Fragment as Fragment$1 } from 'react';
|
5
|
+
import { BoldTool } from './tools/bold.js';
|
6
|
+
import { CodeTool } from './tools/code.js';
|
7
|
+
import { CodeBlockTool } from './tools/code-block.js';
|
8
|
+
import { ItalicTool } from './tools/italic.js';
|
9
|
+
import { LinkTool } from './tools/link.js';
|
10
|
+
import { OrderedListTool } from './tools/ordered-list.js';
|
11
|
+
import { UnderlineTool } from './tools/underline.js';
|
12
|
+
import { UnorderedListTool } from './tools/unordered-list.js';
|
13
|
+
import { FormatTool } from './tools/format.js';
|
14
|
+
import { TextAlignTool } from './tools/text-align.js';
|
15
|
+
import { Flex } from '../../react-components/dist/es/flex/flex.js';
|
16
|
+
|
17
|
+
const defaultTools = [
|
18
|
+
"format",
|
19
|
+
"bold",
|
20
|
+
"italic",
|
21
|
+
"underline",
|
22
|
+
"unordered-list",
|
23
|
+
"ordered-list",
|
24
|
+
"link",
|
25
|
+
"codeblock",
|
26
|
+
"code",
|
27
|
+
"text-align"
|
28
|
+
];
|
29
|
+
const toolMapping = {
|
30
|
+
format: FormatTool,
|
31
|
+
bold: BoldTool,
|
32
|
+
italic: ItalicTool,
|
33
|
+
underline: UnderlineTool,
|
34
|
+
"unordered-list": UnorderedListTool,
|
35
|
+
"ordered-list": OrderedListTool,
|
36
|
+
codeblock: CodeBlockTool,
|
37
|
+
code: CodeTool,
|
38
|
+
link: LinkTool,
|
39
|
+
"text-align": TextAlignTool
|
40
|
+
};
|
41
|
+
const EditorToolbar = ({
|
42
|
+
tools = defaultTools,
|
43
|
+
children
|
44
|
+
}) => {
|
45
|
+
const [editor] = useLexicalComposerContext();
|
46
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children ? /* @__PURE__ */ jsx(Fragment, { children }) : /* @__PURE__ */ jsx(
|
47
|
+
Flex,
|
48
|
+
{
|
49
|
+
css: {
|
50
|
+
gap: "$1"
|
51
|
+
},
|
52
|
+
className: prefixClassName("editor-toolbar"),
|
53
|
+
children: tools.map((_item, i) => {
|
54
|
+
if (_item == null ? void 0 : _item.renderComponent) {
|
55
|
+
const item2 = _item;
|
56
|
+
return (
|
57
|
+
// eslint-disable-next-line react/no-array-index-key
|
58
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: item2.renderComponent({ editor }) }, i)
|
59
|
+
);
|
60
|
+
}
|
61
|
+
const item = _item;
|
62
|
+
const Tool = toolMapping[item];
|
63
|
+
if (!Tool) return null;
|
64
|
+
return (
|
65
|
+
// eslint-disable-next-line react/no-array-index-key
|
66
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Tool, {}) }, i)
|
67
|
+
);
|
68
|
+
})
|
69
|
+
}
|
70
|
+
) });
|
71
|
+
};
|
72
|
+
|
73
|
+
export { EditorToolbar };
|
74
|
+
//# sourceMappingURL=toolbar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"toolbar.js","sources":["../../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { Flex } from '@sparrowengg/twigs-react';\nimport { prefixClassName } from '@src/utils/prefix-class-name';\nimport { LexicalEditor } from 'lexical';\nimport { Fragment, ReactNode } from 'react';\nimport {\n BoldTool,\n CodeBlockTool,\n CodeTool,\n FormatTool,\n ItalicTool,\n LinkTool,\n OrderedListTool,\n TextAlignTool,\n UnderlineTool,\n UnorderedListTool\n} from './tools';\n\nexport type DefaultToolbarTools =\n | 'format'\n | 'bold'\n | 'italic'\n | 'underline'\n | 'ordered-list'\n | 'unordered-list'\n | 'link'\n | 'codeblock'\n | 'code'\n | 'text-align';\n\ntype CustomTool = {\n renderComponent: (props: { editor: LexicalEditor }) => ReactNode;\n};\n\nexport type ToolbarTools = (DefaultToolbarTools | CustomTool)[];\n\nconst defaultTools: DefaultToolbarTools[] = [\n 'format',\n 'bold',\n 'italic',\n 'underline',\n 'unordered-list',\n 'ordered-list',\n 'link',\n 'codeblock',\n 'code',\n 'text-align'\n];\n\nconst toolMapping = {\n format: FormatTool,\n bold: BoldTool,\n italic: ItalicTool,\n underline: UnderlineTool,\n 'unordered-list': UnorderedListTool,\n 'ordered-list': OrderedListTool,\n codeblock: CodeBlockTool,\n code: CodeTool,\n link: LinkTool,\n 'text-align': TextAlignTool\n};\n\nexport const EditorToolbar = ({\n tools = defaultTools,\n children\n}: {\n tools?: ToolbarTools;\n children?: ReactNode;\n}) => {\n const [editor] = useLexicalComposerContext();\n\n return (\n <>\n {children ? (\n <>{children}</>\n ) : (\n <Flex\n css={{\n gap: '$1'\n }}\n className={prefixClassName('editor-toolbar')}\n >\n {tools.map((_item, i) => {\n if ((_item as CustomTool)?.renderComponent) {\n const item = _item as CustomTool;\n return (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{item.renderComponent({ editor })}</Fragment>\n );\n }\n\n const item = _item as DefaultToolbarTools;\n const Tool = toolMapping[item];\n if (!Tool) return null;\n\n return (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>\n <Tool />\n </Fragment>\n );\n })}\n </Flex>\n )}\n </>\n );\n};\n"],"names":["item","Fragment"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,YAAsC,GAAA;AAAA,EAC1C,QAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA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UAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,KADO,CAEf;AAAA;AAAA,OAEH;AAAA;AAAA,GAGP,EAAA,CAAA;AAEJ;;;;"}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
3
|
+
import { FORMAT_TEXT_COMMAND } from 'lexical';
|
4
|
+
import { clsx } from '../../../react-editor/node_modules/clsx/dist/clsx.js';
|
5
|
+
import { useToolbarStore } from '../../toolbar-context/store.js';
|
6
|
+
import { IconButton } from '../../../react-components/dist/es/button/icon-button.js';
|
7
|
+
import { BoldIcon } from '../../../react-icons/dist/es/icons/bold.js';
|
8
|
+
|
9
|
+
var __defProp = Object.defineProperty;
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
14
|
+
var __spreadValues = (a, b) => {
|
15
|
+
for (var prop in b || (b = {}))
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
if (__getOwnPropSymbols)
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
20
|
+
if (__propIsEnum.call(b, prop))
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
22
|
+
}
|
23
|
+
return a;
|
24
|
+
};
|
25
|
+
const BoldTool = ({ renderButton, buttonProps }) => {
|
26
|
+
const [editor] = useLexicalComposerContext();
|
27
|
+
const [active] = useToolbarStore((state) => state.data.isBold);
|
28
|
+
const handleClick = () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
29
|
+
if (renderButton) {
|
30
|
+
return renderButton({ editor, active, onChange: handleClick });
|
31
|
+
}
|
32
|
+
return /* @__PURE__ */ jsx(
|
33
|
+
IconButton,
|
34
|
+
__spreadValues({
|
35
|
+
icon: /* @__PURE__ */ jsx(BoldIcon, {}),
|
36
|
+
variant: active ? "solid" : "ghost",
|
37
|
+
className: clsx("twigs-editor-tool-button", {
|
38
|
+
"twigs-editor-tool-button--active": active
|
39
|
+
}),
|
40
|
+
color: "default",
|
41
|
+
onClick: handleClick,
|
42
|
+
title: active ? "Clear bold formatting" : "Format text to bold",
|
43
|
+
"data-tool": "bold",
|
44
|
+
"aria-label": active ? "Clear bold formatting" : "Format text to bold"
|
45
|
+
}, buttonProps)
|
46
|
+
);
|
47
|
+
};
|
48
|
+
|
49
|
+
export { BoldTool };
|
50
|
+
//# sourceMappingURL=bold.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bold.js","sources":["../../../../../src/components/toolbar/tools/bold.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { BoldIcon } from '@sparrowengg/twigs-react-icons';\nimport { IconButton } from '@sparrowengg/twigs-react';\nimport { FORMAT_TEXT_COMMAND } from 'lexical';\nimport clsx from 'clsx';\nimport { useToolbarStore } from '../../toolbar-context/store';\nimport { ToolbarButtonProps } from './commons';\n\nexport const BoldTool = ({ renderButton, buttonProps }: ToolbarButtonProps) => {\n const [editor] = useLexicalComposerContext();\n const [active] = useToolbarStore((state) => state.data.isBold);\n\n const handleClick = () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');\n\n if (renderButton) {\n return renderButton({ editor, active, onChange: handleClick });\n }\n\n return (\n <IconButton\n icon={<BoldIcon />}\n variant={active ? 'solid' : 'ghost'}\n className={clsx('twigs-editor-tool-button', {\n 'twigs-editor-tool-button--active': active\n })}\n color=\"default\"\n onClick={handleClick}\n title={active ? 'Clear bold formatting' : 'Format text to bold'}\n data-tool=\"bold\"\n aria-label={active ? 'Clear bold formatting' : 'Format text to bold'}\n {...buttonProps}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAM,QAAW,GAAA,CAAC,EAAE,YAAA,EAAc,aAAsC,KAAA;AAC7E,EAAM,MAAA,CAAC,MAAM,CAAA,GAAI,yBAA0B,EAAA;AAC3C,EAAM,MAAA,CAAC,MAAM,CAAI,GAAA,eAAA,CAAgB,CAAC,KAAU,KAAA,KAAA,CAAM,KAAK,MAAM,CAAA;AAE7D,EAAA,MAAM,WAAc,GAAA,MAAM,MAAO,CAAA,eAAA,CAAgB,qBAAqB,MAAM,CAAA;AAE5E,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,OAAO,aAAa,EAAE,MAAA,EAAQ,MAAQ,EAAA,QAAA,EAAU,aAAa,CAAA;AAAA;AAG/D,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACC,IAAA,sBAAO,QAAS,EAAA,EAAA,CAAA;AAAA,MAChB,OAAA,EAAS,SAAS,OAAU,GAAA,OAAA;AAAA,MAC5B,SAAA,EAAW,KAAK,0BAA4B,EAAA;AAAA,QAC1C,kCAAoC,EAAA;AAAA,OACrC,CAAA;AAAA,MACD,KAAM,EAAA,SAAA;AAAA,MACN,OAAS,EAAA,WAAA;AAAA,MACT,KAAA,EAAO,SAAS,uBAA0B,GAAA,qBAAA;AAAA,MAC1C,WAAU,EAAA,MAAA;AAAA,MACV,YAAA,EAAY,SAAS,uBAA0B,GAAA;AAAA,KAC3C,EAAA,WAAA;AAAA,GACN;AAEJ;;;;"}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
2
|
+
import { $createCodeNode } from '@lexical/code';
|
3
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
4
|
+
import { $setBlocksType } from '@lexical/selection';
|
5
|
+
import { $getSelection, $createParagraphNode, $isRangeSelection } from 'lexical';
|
6
|
+
import { clsx } from '../../../react-editor/node_modules/clsx/dist/clsx.js';
|
7
|
+
import { useToolbarStore } from '../../toolbar-context/store.js';
|
8
|
+
import { IconButton } from '../../../react-components/dist/es/button/icon-button.js';
|
9
|
+
import { CodeBlockIcon } from '../../../react-icons/dist/es/icons/code-block.js';
|
10
|
+
|
11
|
+
var __defProp = Object.defineProperty;
|
12
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
14
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
15
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
16
|
+
var __spreadValues = (a, b) => {
|
17
|
+
for (var prop in b || (b = {}))
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
if (__getOwnPropSymbols)
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
22
|
+
if (__propIsEnum.call(b, prop))
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
24
|
+
}
|
25
|
+
return a;
|
26
|
+
};
|
27
|
+
const CodeBlockTool = ({
|
28
|
+
renderButton,
|
29
|
+
buttonProps
|
30
|
+
}) => {
|
31
|
+
const [editor] = useLexicalComposerContext();
|
32
|
+
const [format] = useToolbarStore((state) => state.data.format);
|
33
|
+
const active = format === "code";
|
34
|
+
const formatCode = () => {
|
35
|
+
editor.update(() => {
|
36
|
+
let selection = $getSelection();
|
37
|
+
if (active) {
|
38
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
if (selection !== null) {
|
42
|
+
if (selection.isCollapsed()) {
|
43
|
+
$setBlocksType(selection, () => $createCodeNode());
|
44
|
+
} else {
|
45
|
+
const textContent = selection.getTextContent();
|
46
|
+
const codeNode = $createCodeNode();
|
47
|
+
selection.insertNodes([codeNode]);
|
48
|
+
selection = $getSelection();
|
49
|
+
if ($isRangeSelection(selection)) {
|
50
|
+
selection.insertRawText(textContent);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
});
|
55
|
+
};
|
56
|
+
if (renderButton) {
|
57
|
+
return renderButton({ editor, active, onChange: formatCode });
|
58
|
+
}
|
59
|
+
return /* @__PURE__ */ jsx(
|
60
|
+
IconButton,
|
61
|
+
__spreadValues({
|
62
|
+
icon: /* @__PURE__ */ jsx(CodeBlockIcon, {}),
|
63
|
+
variant: active ? "solid" : "ghost",
|
64
|
+
color: "default",
|
65
|
+
"data-tool": "code-block",
|
66
|
+
className: clsx("twigs-editor-tool-button", {
|
67
|
+
"twigs-editor-tool-button--active": active
|
68
|
+
}),
|
69
|
+
onClick: formatCode,
|
70
|
+
title: active ? "Convert code block to paragraph" : "Convert to code block",
|
71
|
+
"aria-label": active ? "Convert code block to paragraph" : "Convert to code block"
|
72
|
+
}, buttonProps)
|
73
|
+
);
|
74
|
+
};
|
75
|
+
|
76
|
+
export { CodeBlockTool };
|
77
|
+
//# sourceMappingURL=code-block.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"code-block.js","sources":["../../../../../src/components/toolbar/tools/code-block.tsx"],"sourcesContent":["import { $createCodeNode } from '@lexical/code';\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { $setBlocksType } from '@lexical/selection';\nimport { CodeBlockIcon } from '@sparrowengg/twigs-react-icons';\nimport { IconButton } from '@sparrowengg/twigs-react';\nimport {\n $createParagraphNode,\n $getSelection,\n $isRangeSelection\n} from 'lexical';\nimport clsx from 'clsx';\nimport { useToolbarStore } from '../../toolbar-context/store';\nimport { ToolbarButtonProps } from './commons';\n\nexport const CodeBlockTool = ({\n renderButton,\n buttonProps\n}: ToolbarButtonProps) => {\n const [editor] = useLexicalComposerContext();\n const [format] = useToolbarStore((state) => state.data.format);\n\n const active = format === 'code';\n\n const formatCode = () => {\n editor.update(() => {\n let selection = $getSelection();\n\n if (active) {\n $setBlocksType(selection, () => $createParagraphNode());\n return;\n }\n\n if (selection !== null) {\n if (selection.isCollapsed()) {\n $setBlocksType(selection, () => $createCodeNode());\n } else {\n const textContent = selection.getTextContent();\n const codeNode = $createCodeNode();\n selection.insertNodes([codeNode]);\n selection = $getSelection();\n if ($isRangeSelection(selection)) {\n selection.insertRawText(textContent);\n }\n }\n }\n });\n };\n\n if (renderButton) {\n return renderButton({ editor, active, onChange: formatCode });\n }\n\n return (\n <IconButton\n icon={<CodeBlockIcon />}\n variant={active ? 'solid' : 'ghost'}\n color=\"default\"\n data-tool=\"code-block\"\n className={clsx('twigs-editor-tool-button', {\n 'twigs-editor-tool-button--active': active\n })}\n onClick={formatCode}\n title={\n active ? 'Convert code block to paragraph' : 'Convert to code block'\n }\n aria-label={\n active ? 'Convert code block to paragraph' : 'Convert to code block'\n }\n {...buttonProps}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EAAM,MAAA,CAAC,MAAM,CAAA,GAAI,yBAA0B,EAAA;AAC3C,EAAM,MAAA,CAAC,MAAM,CAAI,GAAA,eAAA,CAAgB,CAAC,KAAU,KAAA,KAAA,CAAM,KAAK,MAAM,CAAA;AAE7D,EAAA,MAAM,SAAS,MAAW,KAAA,MAAA;AAE1B,EAAA,MAAM,aAAa,MAAM;AACvB,IAAA,MAAA,CAAO,OAAO,MAAM;AAClB,MAAA,IAAI,YAAY,aAAc,EAAA;AAE9B,MAAA,IAAI,MAAQ,EAAA;AACV,QAAe,cAAA,CAAA,SAAA,EAAW,MAAM,oBAAA,EAAsB,CAAA;AACtD,QAAA;AAAA;AAGF,MAAA,IAAI,cAAc,IAAM,EAAA;AACtB,QAAI,IAAA,SAAA,CAAU,aAAe,EAAA;AAC3B,UAAe,cAAA,CAAA,SAAA,EAAW,MAAM,eAAA,EAAiB,CAAA;AAAA,SAC5C,MAAA;AACL,UAAM,MAAA,WAAA,GAAc,UAAU,cAAe,EAAA;AAC7C,UAAA,MAAM,WAAW,eAAgB,EAAA;AACjC,UAAU,SAAA,CAAA,WAAA,CAAY,CAAC,QAAQ,CAAC,CAAA;AAChC,UAAA,SAAA,GAAY,aAAc,EAAA;AAC1B,UAAI,IAAA,iBAAA,CAAkB,SAAS,CAAG,EAAA;AAChC,YAAA,SAAA,CAAU,cAAc,WAAW,CAAA;AAAA;AACrC;AACF;AACF,KACD,CAAA;AAAA,GACH;AAEA,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,OAAO,aAAa,EAAE,MAAA,EAAQ,MAAQ,EAAA,QAAA,EAAU,YAAY,CAAA;AAAA;AAG9D,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACC,IAAA,sBAAO,aAAc,EAAA,EAAA,CAAA;AAAA,MACrB,OAAA,EAAS,SAAS,OAAU,GAAA,OAAA;AAAA,MAC5B,KAAM,EAAA,SAAA;AAAA,MACN,WAAU,EAAA,YAAA;AAAA,MACV,SAAA,EAAW,KAAK,0BAA4B,EAAA;AAAA,QAC1C,kCAAoC,EAAA;AAAA,OACrC,CAAA;AAAA,MACD,OAAS,EAAA,UAAA;AAAA,MACT,KAAA,EACE,SAAS,iCAAoC,GAAA,uBAAA;AAAA,MAE/C,YAAA,EACE,SAAS,iCAAoC,GAAA;AAAA,KAE3C,EAAA,WAAA;AAAA,GACN;AAEJ;;;;"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
3
|
+
import { FORMAT_TEXT_COMMAND } from 'lexical';
|
4
|
+
import { clsx } from '../../../react-editor/node_modules/clsx/dist/clsx.js';
|
5
|
+
import { useToolbarStore } from '../../toolbar-context/store.js';
|
6
|
+
import { IconButton } from '../../../react-components/dist/es/button/icon-button.js';
|
7
|
+
import { CodeIcon } from '../../../react-icons/dist/es/icons/code.js';
|
8
|
+
|
9
|
+
var __defProp = Object.defineProperty;
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
14
|
+
var __spreadValues = (a, b) => {
|
15
|
+
for (var prop in b || (b = {}))
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
if (__getOwnPropSymbols)
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
20
|
+
if (__propIsEnum.call(b, prop))
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
22
|
+
}
|
23
|
+
return a;
|
24
|
+
};
|
25
|
+
const CodeTool = ({ renderButton, buttonProps }) => {
|
26
|
+
const [editor] = useLexicalComposerContext();
|
27
|
+
const [active] = useToolbarStore((state) => state.data.isCode);
|
28
|
+
const handleClick = () => {
|
29
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
30
|
+
};
|
31
|
+
if (renderButton) {
|
32
|
+
return renderButton({ editor, active, onChange: handleClick });
|
33
|
+
}
|
34
|
+
return /* @__PURE__ */ jsx(
|
35
|
+
IconButton,
|
36
|
+
__spreadValues({
|
37
|
+
icon: /* @__PURE__ */ jsx(CodeIcon, {}),
|
38
|
+
variant: active ? "solid" : "ghost",
|
39
|
+
color: "default",
|
40
|
+
onClick: handleClick,
|
41
|
+
"data-tool": "code",
|
42
|
+
className: clsx("twigs-editor-tool-button", {
|
43
|
+
"twigs-editor-tool-button--active": active
|
44
|
+
}),
|
45
|
+
title: active ? "Clear inline code formatting" : "Format text to inline code",
|
46
|
+
"aria-label": active ? "Clear inline code formatting" : "Format text to inline code"
|
47
|
+
}, buttonProps)
|
48
|
+
);
|
49
|
+
};
|
50
|
+
|
51
|
+
export { CodeTool };
|
52
|
+
//# sourceMappingURL=code.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"code.js","sources":["../../../../../src/components/toolbar/tools/code.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { CodeIcon } from '@sparrowengg/twigs-react-icons';\nimport { IconButton } from '@sparrowengg/twigs-react';\nimport { FORMAT_TEXT_COMMAND } from 'lexical';\nimport clsx from 'clsx';\nimport { useToolbarStore } from '../../toolbar-context/store';\nimport { ToolbarButtonProps } from './commons';\n\nexport const CodeTool = ({ renderButton, buttonProps }: ToolbarButtonProps) => {\n const [editor] = useLexicalComposerContext();\n const [active] = useToolbarStore((state) => state.data.isCode);\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'code');\n };\n\n if (renderButton) {\n return renderButton({ editor, active, onChange: handleClick });\n }\n\n return (\n <IconButton\n icon={<CodeIcon />}\n variant={active ? 'solid' : 'ghost'}\n color=\"default\"\n onClick={handleClick}\n data-tool=\"code\"\n className={clsx('twigs-editor-tool-button', {\n 'twigs-editor-tool-button--active': active\n })}\n title={\n active ? 'Clear inline code formatting' : 'Format text to inline code'\n }\n aria-label={\n active ? 'Clear inline code formatting' : 'Format text to inline code'\n }\n {...buttonProps}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAM,QAAW,GAAA,CAAC,EAAE,YAAA,EAAc,aAAsC,KAAA;AAC7E,EAAM,MAAA,CAAC,MAAM,CAAA,GAAI,yBAA0B,EAAA;AAC3C,EAAM,MAAA,CAAC,MAAM,CAAI,GAAA,eAAA,CAAgB,CAAC,KAAU,KAAA,KAAA,CAAM,KAAK,MAAM,CAAA;AAE7D,EAAA,MAAM,cAAc,MAAM;AACxB,IAAO,MAAA,CAAA,eAAA,CAAgB,qBAAqB,MAAM,CAAA;AAAA,GACpD;AAEA,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,OAAO,aAAa,EAAE,MAAA,EAAQ,MAAQ,EAAA,QAAA,EAAU,aAAa,CAAA;AAAA;AAG/D,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACC,IAAA,sBAAO,QAAS,EAAA,EAAA,CAAA;AAAA,MAChB,OAAA,EAAS,SAAS,OAAU,GAAA,OAAA;AAAA,MAC5B,KAAM,EAAA,SAAA;AAAA,MACN,OAAS,EAAA,WAAA;AAAA,MACT,WAAU,EAAA,MAAA;AAAA,MACV,SAAA,EAAW,KAAK,0BAA4B,EAAA;AAAA,QAC1C,kCAAoC,EAAA;AAAA,OACrC,CAAA;AAAA,MACD,KAAA,EACE,SAAS,8BAAiC,GAAA,4BAAA;AAAA,MAE5C,YAAA,EACE,SAAS,8BAAiC,GAAA;AAAA,KAExC,EAAA,WAAA;AAAA,GACN;AAEJ;;;;"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { $setBlocksType } from '@lexical/selection';
|
2
|
+
import { $getSelection, $isRangeSelection, $createParagraphNode } from 'lexical';
|
3
|
+
|
4
|
+
const formatParagraph = (editor) => {
|
5
|
+
editor.update(() => {
|
6
|
+
const selection = $getSelection();
|
7
|
+
if ($isRangeSelection(selection)) {
|
8
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
9
|
+
}
|
10
|
+
});
|
11
|
+
};
|
12
|
+
|
13
|
+
export { formatParagraph };
|
14
|
+
//# sourceMappingURL=commons.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"commons.js","sources":["../../../../../src/components/toolbar/tools/commons.ts"],"sourcesContent":["import { $setBlocksType } from '@lexical/selection';\nimport { IconButtonProps } from '@sparrowengg/twigs-react';\nimport {\n $createParagraphNode,\n $getSelection,\n $isRangeSelection,\n LexicalEditor\n} from 'lexical';\nimport { ReactNode } from 'react';\n\nexport type RenderButtonProps = {\n editor: LexicalEditor;\n active: boolean;\n onChange?: () => void;\n};\n\nexport type ToolbarButtonProps = {\n renderButton?: (props: RenderButtonProps) => ReactNode;\n buttonProps?: IconButtonProps;\n};\n\nexport const formatParagraph = (editor: LexicalEditor) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n $setBlocksType(selection, () => $createParagraphNode());\n }\n });\n};\n"],"names":[],"mappings":";;;AAqBa,MAAA,eAAA,GAAkB,CAAC,MAA0B,KAAA;AACxD,EAAA,MAAA,CAAO,OAAO,MAAM;AAClB,IAAA,MAAM,YAAY,aAAc,EAAA;AAChC,IAAI,IAAA,iBAAA,CAAkB,SAAS,CAAG,EAAA;AAChC,MAAe,cAAA,CAAA,SAAA,EAAW,MAAM,oBAAA,EAAsB,CAAA;AAAA;AACxD,GACD,CAAA;AACH;;;;"}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
3
|
+
import { $createHeadingNode } from '@lexical/rich-text';
|
4
|
+
import { $setBlocksType } from '@lexical/selection';
|
5
|
+
import { $getSelection, $isRangeSelection, $createParagraphNode } from 'lexical';
|
6
|
+
import { useToolbarStore } from '../../toolbar-context/store.js';
|
7
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../../../react-components/dist/es/dropdown/dropdown.js';
|
8
|
+
import { IconButton } from '../../../react-components/dist/es/button/icon-button.js';
|
9
|
+
import { TextFormatIcon } from '../../../react-icons/dist/es/icons/text-format.js';
|
10
|
+
|
11
|
+
var __defProp = Object.defineProperty;
|
12
|
+
var __defProps = Object.defineProperties;
|
13
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
14
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
16
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
17
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
18
|
+
var __spreadValues = (a, b) => {
|
19
|
+
for (var prop in b || (b = {}))
|
20
|
+
if (__hasOwnProp.call(b, prop))
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
22
|
+
if (__getOwnPropSymbols)
|
23
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
24
|
+
if (__propIsEnum.call(b, prop))
|
25
|
+
__defNormalProp(a, prop, b[prop]);
|
26
|
+
}
|
27
|
+
return a;
|
28
|
+
};
|
29
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
30
|
+
var __objRest = (source, exclude) => {
|
31
|
+
var target = {};
|
32
|
+
for (var prop in source)
|
33
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
34
|
+
target[prop] = source[prop];
|
35
|
+
if (source != null && __getOwnPropSymbols)
|
36
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
37
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
38
|
+
target[prop] = source[prop];
|
39
|
+
}
|
40
|
+
return target;
|
41
|
+
};
|
42
|
+
const formatMapping = {
|
43
|
+
paragraph: "Paragraph",
|
44
|
+
h1: "Heading 1",
|
45
|
+
h2: "Heading 2",
|
46
|
+
h3: "Heading 3",
|
47
|
+
h4: "Heading 4",
|
48
|
+
h5: "Heading 5",
|
49
|
+
h6: "Heading 6"
|
50
|
+
};
|
51
|
+
const FormatTool = ({
|
52
|
+
renderButton,
|
53
|
+
dropdownMenuProps,
|
54
|
+
dropdownMenuContentProps,
|
55
|
+
dropdownMenuItemProps,
|
56
|
+
dropdownMenuTriggerProps,
|
57
|
+
dropdownMenuTriggerButtonProps,
|
58
|
+
renderDropdownTrigger
|
59
|
+
}) => {
|
60
|
+
const [editor] = useLexicalComposerContext();
|
61
|
+
const [format] = useToolbarStore((state) => state.data.format);
|
62
|
+
const formatText = (type) => {
|
63
|
+
if (type === "paragraph") {
|
64
|
+
formatParagraph();
|
65
|
+
} else {
|
66
|
+
formatHeading(type);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
const formatHeading = (headingSize) => {
|
70
|
+
if (headingSize) {
|
71
|
+
editor.update(() => {
|
72
|
+
const selection = $getSelection();
|
73
|
+
if ($isRangeSelection(selection)) {
|
74
|
+
$setBlocksType(selection, () => $createHeadingNode(headingSize));
|
75
|
+
}
|
76
|
+
});
|
77
|
+
}
|
78
|
+
};
|
79
|
+
const formatParagraph = () => {
|
80
|
+
editor.update(() => {
|
81
|
+
const selection = $getSelection();
|
82
|
+
if ($isRangeSelection(selection)) {
|
83
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
84
|
+
}
|
85
|
+
});
|
86
|
+
};
|
87
|
+
const _a = formatMapping, { paragraph } = _a, headings = __objRest(_a, ["paragraph"]);
|
88
|
+
if (renderButton) {
|
89
|
+
return renderButton({ editor, active: format, onChange: formatText });
|
90
|
+
}
|
91
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, __spreadProps(__spreadValues({}, dropdownMenuProps), { children: [
|
92
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, __spreadProps(__spreadValues({ asChild: true }, dropdownMenuTriggerProps), { children: renderDropdownTrigger ? renderDropdownTrigger() : /* @__PURE__ */ jsx(
|
93
|
+
IconButton,
|
94
|
+
__spreadValues({
|
95
|
+
icon: /* @__PURE__ */ jsx(TextFormatIcon, {}),
|
96
|
+
variant: "ghost",
|
97
|
+
color: "default",
|
98
|
+
className: "twigs-editor-tool-button",
|
99
|
+
"data-tool": "format"
|
100
|
+
}, dropdownMenuTriggerButtonProps)
|
101
|
+
) })),
|
102
|
+
/* @__PURE__ */ jsxs(
|
103
|
+
DropdownMenuContent,
|
104
|
+
__spreadProps(__spreadValues({
|
105
|
+
className: "twigs-editor-toolbar__format-options"
|
106
|
+
}, dropdownMenuContentProps), {
|
107
|
+
children: [
|
108
|
+
/* @__PURE__ */ jsx(
|
109
|
+
DropdownMenuItem,
|
110
|
+
__spreadProps(__spreadValues({
|
111
|
+
onClick: formatParagraph
|
112
|
+
}, typeof dropdownMenuItemProps === "function" ? dropdownMenuItemProps({ type: "paragraph", formatText }) : dropdownMenuItemProps), {
|
113
|
+
children: paragraph
|
114
|
+
})
|
115
|
+
),
|
116
|
+
Object.keys(headings).map(
|
117
|
+
(item) => /* @__PURE__ */ jsx(
|
118
|
+
DropdownMenuItem,
|
119
|
+
__spreadProps(__spreadValues({
|
120
|
+
onClick: () => formatHeading(item)
|
121
|
+
}, typeof dropdownMenuItemProps === "function" ? dropdownMenuItemProps({ type: item, formatText }) : dropdownMenuItemProps), {
|
122
|
+
children: formatMapping[item]
|
123
|
+
}),
|
124
|
+
item
|
125
|
+
)
|
126
|
+
)
|
127
|
+
]
|
128
|
+
})
|
129
|
+
)
|
130
|
+
] }));
|
131
|
+
};
|
132
|
+
|
133
|
+
export { FormatTool };
|
134
|
+
//# sourceMappingURL=format.js.map
|