@payloadcms/richtext-lexical 3.0.0-alpha.68 → 3.0.0-alpha.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/components.d.ts +3 -2
- package/dist/exports/components.d.ts.map +1 -1
- package/dist/exports/components.js +3 -2
- package/dist/exports/components.js.map +1 -1
- package/dist/field/features/align/feature.client.d.ts.map +1 -1
- package/dist/field/features/align/feature.client.js +126 -46
- package/dist/field/features/align/feature.client.js.map +1 -1
- package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
- package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
- package/dist/field/features/align/{inlineToolbarAlignGroup.js → toolbarAlignGroup.js} +3 -3
- package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
- package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.client.js +37 -23
- package/dist/field/features/blockquote/feature.client.js.map +1 -1
- package/dist/field/features/blocks/component/index.d.ts.map +1 -1
- package/dist/field/features/blocks/component/index.js +1 -1
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.client.js +39 -8
- package/dist/field/features/blocks/feature.client.js.map +1 -1
- package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
- package/dist/field/features/blocks/populationPromise.js +2 -1
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/bold/feature.client.js +23 -19
- package/dist/field/features/format/bold/feature.client.js.map +1 -1
- package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/inlineCode/feature.client.js +23 -19
- package/dist/field/features/format/inlineCode/feature.client.js.map +1 -1
- package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/italic/feature.client.js +23 -19
- package/dist/field/features/format/italic/feature.client.js.map +1 -1
- package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
- package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.js +23 -19
- package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/subscript/feature.client.js +23 -19
- package/dist/field/features/format/subscript/feature.client.js.map +1 -1
- package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/superscript/feature.client.js +23 -19
- package/dist/field/features/format/superscript/feature.client.js.map +1 -1
- package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/underline/feature.client.js +23 -19
- package/dist/field/features/format/underline/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +49 -29
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/feature.client.js +27 -4
- package/dist/field/features/horizontalRule/feature.client.js.map +1 -1
- package/dist/field/features/indent/feature.client.d.ts.map +1 -1
- package/dist/field/features/indent/feature.client.js +41 -37
- package/dist/field/features/indent/feature.client.js.map +1 -1
- package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
- package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
- package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
- package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
- package/dist/field/features/link/feature.client.d.ts.map +1 -1
- package/dist/field/features/link/feature.client.js +44 -40
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/populationPromise.d.ts.map +1 -1
- package/dist/field/features/link/populationPromise.js +2 -1
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js +44 -19
- package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/orderedList/feature.client.js +44 -19
- package/dist/field/features/lists/orderedList/feature.client.js.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.client.js +44 -19
- package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -1
- package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.client.js +36 -22
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.client.js +30 -4
- package/dist/field/features/relationship/feature.client.js.map +1 -1
- package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
- package/dist/field/features/relationship/populationPromise.js +2 -1
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
- package/dist/field/features/shared/{inlineToolbar → toolbar}/textDropdownGroup.js +2 -2
- package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +6 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.scss +81 -0
- package/dist/field/features/toolbars/fixed/feature.client.d.ts +3 -0
- package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
- package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
- package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.server.js +16 -0
- package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +6 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
- package/dist/field/{lexical/plugins → features}/toolbars/inline/Toolbar/index.js +43 -17
- package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
- package/dist/field/{lexical/plugins → features}/toolbars/inline/Toolbar/index.scss +3 -8
- package/dist/field/features/toolbars/inline/feature.client.d.ts +3 -0
- package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
- package/dist/field/features/toolbars/inline/feature.client.js +20 -0
- package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
- package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
- package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
- package/dist/field/features/toolbars/inline/feature.server.js +16 -0
- package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
- package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarButton/index.js +9 -5
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/DropDown.js +14 -64
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars}/types.d.ts +16 -8
- package/dist/field/features/toolbars/types.d.ts.map +1 -0
- package/dist/field/features/toolbars/types.js.map +1 -0
- package/dist/field/features/types.d.ts +7 -7
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/feature.client.d.ts.map +1 -1
- package/dist/field/features/upload/feature.client.js +29 -4
- package/dist/field/features/upload/feature.client.js.map +1 -1
- package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
- package/dist/field/features/upload/populationPromise.js +3 -1
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
- package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
- package/dist/field/lexical/EditorFocusProvider.js +78 -0
- package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +20 -4
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/field/lexical/LexicalProvider.js +3 -2
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/field/lexical/config/server/default.d.ts.map +1 -1
- package/dist/field/lexical/config/server/default.js +3 -1
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +6 -6
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js +10 -10
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
- package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
- package/dist/field/lexical/ui/icons/Add/index.js +16 -0
- package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/populate/populate.d.ts +2 -1
- package/dist/populate/populate.d.ts.map +1 -1
- package/dist/populate/populate.js +13 -11
- package/dist/populate/populate.js.map +1 -1
- package/dist/populate/populateLexicalPopulationPromises.d.ts +1 -1
- package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populate/populateLexicalPopulationPromises.js +2 -1
- package/dist/populate/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populate/recurseNestedFields.d.ts +2 -1
- package/dist/populate/recurseNestedFields.d.ts.map +1 -1
- package/dist/populate/recurseNestedFields.js +2 -1
- package/dist/populate/recurseNestedFields.js.map +1 -1
- package/package.json +10 -10
- package/dist/field/features/align/inlineToolbarAlignGroup.d.ts +0 -3
- package/dist/field/features/align/inlineToolbarAlignGroup.d.ts.map +0 -1
- package/dist/field/features/align/inlineToolbarAlignGroup.js.map +0 -1
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts +0 -3
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts.map +0 -1
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.js +0 -10
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.js.map +0 -1
- package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts +0 -3
- package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts.map +0 -1
- package/dist/field/features/indent/inlineToolbarIndentGroup.js +0 -10
- package/dist/field/features/indent/inlineToolbarIndentGroup.js.map +0 -1
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts +0 -3
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts.map +0 -1
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js +0 -10
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js.map +0 -1
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts +0 -3
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts.map +0 -1
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts +0 -40
- package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/fixed/types.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts +0 -6
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts +0 -8
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts +0 -17
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts +0 -18
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js +0 -42
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/types.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/types.js +0 -3
- package/dist/field/lexical/plugins/toolbars/inline/types.js.map +0 -1
- /package/dist/field/{lexical/plugins/toolbars/fixed → features/toolbars}/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/underline/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { UnderlineIcon } from '../../../lexical/ui/icons/Underline/index.js'\nimport { createClientComponent } from '../../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/underline/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { UnderlineIcon } from '../../../lexical/ui/icons/Underline/index.js'\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { toolbarFormatGroupWithItems } from '../shared/toolbarFormatGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFormatGroupWithItems([\n {\n ChildComponent: UnderlineIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n return selection.hasFormat('underline')\n }\n return false\n },\n key: 'underline',\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline')\n },\n order: 3,\n },\n ]),\n]\n\nconst UnderlineFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n return {\n clientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n },\n }\n}\n\nexport const UnderlineFeatureClientComponent = createClientComponent(UnderlineFeatureClient)\n"],"names":["$isRangeSelection","FORMAT_TEXT_COMMAND","UnderlineIcon","createClientComponent","toolbarFormatGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","hasFormat","key","onSelect","editor","dispatchCommand","order","UnderlineFeatureClient","props","clientFeatureProps","feature","toolbarFixed","groups","toolbarInline","UnderlineFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,iBAAiB,EAAEC,mBAAmB,QAAQ,UAAS;AAKhE,SAASC,aAAa,QAAQ,+CAA8C;AAC5E,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,2BAA2B,QAAQ,kCAAiC;AAE7E,MAAMC,gBAAgC;IACpCD,4BAA4B;QAC1B;YACEE,gBAAgBJ;YAChBK,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAIR,kBAAkBQ,YAAY;oBAChC,OAAOA,UAAUC,SAAS,CAAC;gBAC7B;gBACA,OAAO;YACT;YACAC,KAAK;YACLC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACZ,qBAAqB;YAC9C;YACAa,OAAO;QACT;KACD;CACF;AAED,MAAMC,yBAAmE,CAACC;IACxE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS;YACP,OAAO;gBACLD,oBAAoBD;gBACpBG,cAAc;oBACZC,QAAQf;gBACV;gBACAgB,eAAe;oBACbD,QAAQf;gBACV;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAMiB,kCAAkCnB,sBAAsBY,wBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AA0G9D,eAAO,MAAM,6BAA6B,qFAA8C,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { $isHeadingNode } from '@lexical/rich-text';
|
|
2
3
|
import { $createHeadingNode, HeadingNode } from '@lexical/rich-text';
|
|
3
4
|
import { $setBlocksType } from '@lexical/selection';
|
|
4
|
-
import { $getSelection } from 'lexical';
|
|
5
|
+
import { $getSelection, $isRangeSelection } from 'lexical';
|
|
5
6
|
import { H1Icon } from '../../lexical/ui/icons/H1/index.js';
|
|
6
7
|
import { H2Icon } from '../../lexical/ui/icons/H2/index.js';
|
|
7
8
|
import { H3Icon } from '../../lexical/ui/icons/H3/index.js';
|
|
@@ -9,7 +10,7 @@ import { H4Icon } from '../../lexical/ui/icons/H4/index.js';
|
|
|
9
10
|
import { H5Icon } from '../../lexical/ui/icons/H5/index.js';
|
|
10
11
|
import { H6Icon } from '../../lexical/ui/icons/H6/index.js';
|
|
11
12
|
import { createClientComponent } from '../createClientComponent.js';
|
|
12
|
-
import {
|
|
13
|
+
import { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js';
|
|
13
14
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
14
15
|
const setHeading = (headingSize)=>{
|
|
15
16
|
const selection = $getSelection();
|
|
@@ -24,17 +25,48 @@ const iconImports = {
|
|
|
24
25
|
h6: H6Icon
|
|
25
26
|
};
|
|
26
27
|
const HeadingFeatureClient = (props)=>{
|
|
27
|
-
const { enabledHeadingSizes = [
|
|
28
|
-
'h1',
|
|
29
|
-
'h2',
|
|
30
|
-
'h3',
|
|
31
|
-
'h4',
|
|
32
|
-
'h5',
|
|
33
|
-
'h6'
|
|
34
|
-
] } = props;
|
|
35
28
|
return {
|
|
36
29
|
clientFeatureProps: props,
|
|
37
30
|
feature: ()=>{
|
|
31
|
+
const { enabledHeadingSizes = [
|
|
32
|
+
'h1',
|
|
33
|
+
'h2',
|
|
34
|
+
'h3',
|
|
35
|
+
'h4',
|
|
36
|
+
'h5',
|
|
37
|
+
'h6'
|
|
38
|
+
] } = props;
|
|
39
|
+
const toolbarGroups = [
|
|
40
|
+
toolbarTextDropdownGroupWithItems(enabledHeadingSizes.map((headingSize, i)=>{
|
|
41
|
+
return {
|
|
42
|
+
ChildComponent: iconImports[headingSize],
|
|
43
|
+
isActive: ({ selection })=>{
|
|
44
|
+
if (!$isRangeSelection(selection)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
for (const node of selection.getNodes()){
|
|
48
|
+
if ($isHeadingNode(node) && node.getTag() === headingSize) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const parent = node.getParent();
|
|
52
|
+
if ($isHeadingNode(parent) && parent.getTag() === headingSize) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
},
|
|
59
|
+
key: headingSize,
|
|
60
|
+
label: `Heading ${headingSize.charAt(1)}`,
|
|
61
|
+
onSelect: ({ editor })=>{
|
|
62
|
+
editor.update(()=>{
|
|
63
|
+
setHeading(headingSize);
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
order: i + 2
|
|
67
|
+
};
|
|
68
|
+
}))
|
|
69
|
+
];
|
|
38
70
|
return {
|
|
39
71
|
clientFeatureProps: props,
|
|
40
72
|
markdownTransformers: [
|
|
@@ -46,16 +78,15 @@ const HeadingFeatureClient = (props)=>{
|
|
|
46
78
|
slashMenu: {
|
|
47
79
|
groups: enabledHeadingSizes?.length ? [
|
|
48
80
|
{
|
|
49
|
-
displayName: 'Basic',
|
|
50
81
|
items: enabledHeadingSizes.map((headingSize)=>{
|
|
51
82
|
return {
|
|
52
83
|
Icon: iconImports[headingSize],
|
|
53
|
-
displayName: `Heading ${headingSize.charAt(1)}`,
|
|
54
84
|
key: `heading-${headingSize.charAt(1)}`,
|
|
55
85
|
keywords: [
|
|
56
86
|
'heading',
|
|
57
87
|
headingSize
|
|
58
88
|
],
|
|
89
|
+
label: `Heading ${headingSize.charAt(1)}`,
|
|
59
90
|
onSelect: ({ editor })=>{
|
|
60
91
|
editor.update(()=>{
|
|
61
92
|
setHeading(headingSize);
|
|
@@ -63,27 +94,16 @@ const HeadingFeatureClient = (props)=>{
|
|
|
63
94
|
}
|
|
64
95
|
};
|
|
65
96
|
}),
|
|
66
|
-
key: 'basic'
|
|
97
|
+
key: 'basic',
|
|
98
|
+
label: 'Basic'
|
|
67
99
|
}
|
|
68
100
|
] : []
|
|
69
101
|
},
|
|
102
|
+
toolbarFixed: {
|
|
103
|
+
groups: enabledHeadingSizes?.length ? toolbarGroups : []
|
|
104
|
+
},
|
|
70
105
|
toolbarInline: {
|
|
71
|
-
groups: enabledHeadingSizes?.length ? [
|
|
72
|
-
inlineToolbarTextDropdownGroupWithItems(enabledHeadingSizes.map((headingSize, i)=>{
|
|
73
|
-
return {
|
|
74
|
-
ChildComponent: iconImports[headingSize],
|
|
75
|
-
isActive: ()=>false,
|
|
76
|
-
key: headingSize,
|
|
77
|
-
label: `Heading ${headingSize.charAt(1)}`,
|
|
78
|
-
onSelect: ({ editor })=>{
|
|
79
|
-
editor.update(()=>{
|
|
80
|
-
setHeading(headingSize);
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
order: i + 2
|
|
84
|
-
};
|
|
85
|
-
}))
|
|
86
|
-
] : []
|
|
106
|
+
groups: enabledHeadingSizes?.length ? toolbarGroups : []
|
|
87
107
|
}
|
|
88
108
|
};
|
|
89
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $createHeadingNode, HeadingNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { HeadingFeatureProps } from './feature.server.js'\n\nimport { H1Icon } from '../../lexical/ui/icons/H1/index.js'\nimport { H2Icon } from '../../lexical/ui/icons/H2/index.js'\nimport { H3Icon } from '../../lexical/ui/icons/H3/index.js'\nimport { H4Icon } from '../../lexical/ui/icons/H4/index.js'\nimport { H5Icon } from '../../lexical/ui/icons/H5/index.js'\nimport { H6Icon } from '../../lexical/ui/icons/H6/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $isHeadingNode } from '@lexical/rich-text'\nimport { $createHeadingNode, HeadingNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { HeadingFeatureProps } from './feature.server.js'\n\nimport { H1Icon } from '../../lexical/ui/icons/H1/index.js'\nimport { H2Icon } from '../../lexical/ui/icons/H2/index.js'\nimport { H3Icon } from '../../lexical/ui/icons/H3/index.js'\nimport { H4Icon } from '../../lexical/ui/icons/H4/index.js'\nimport { H5Icon } from '../../lexical/ui/icons/H5/index.js'\nimport { H6Icon } from '../../lexical/ui/icons/H6/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst setHeading = (headingSize: HeadingTagType) => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createHeadingNode(headingSize))\n}\n\nconst iconImports = {\n h1: H1Icon,\n h2: H2Icon,\n h3: H3Icon,\n h4: H4Icon,\n h5: H5Icon,\n h6: H6Icon,\n}\n\nconst HeadingFeatureClient: FeatureProviderProviderClient<HeadingFeatureProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n const toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems(\n enabledHeadingSizes.map((headingSize, i) => {\n return {\n ChildComponent: iconImports[headingSize],\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isHeadingNode(node) && node.getTag() === headingSize) {\n continue\n }\n\n const parent = node.getParent()\n if ($isHeadingNode(parent) && parent.getTag() === headingSize) {\n continue\n }\n\n return false\n }\n return true\n },\n key: headingSize,\n label: `Heading ${headingSize.charAt(1)}`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n setHeading(headingSize)\n })\n },\n order: i + 2,\n }\n }),\n ),\n ]\n\n return {\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [HeadingNode],\n slashMenu: {\n groups: enabledHeadingSizes?.length\n ? [\n {\n items: enabledHeadingSizes.map((headingSize) => {\n return {\n Icon: iconImports[headingSize],\n key: `heading-${headingSize.charAt(1)}`,\n keywords: ['heading', headingSize],\n label: `Heading ${headingSize.charAt(1)}`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n setHeading(headingSize)\n })\n },\n }\n }),\n key: 'basic',\n label: 'Basic',\n },\n ]\n : [],\n },\n toolbarFixed: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n toolbarInline: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n }\n },\n }\n}\n\nexport const HeadingFeatureClientComponent = createClientComponent(HeadingFeatureClient)\n"],"names":["$isHeadingNode","$createHeadingNode","HeadingNode","$setBlocksType","$getSelection","$isRangeSelection","H1Icon","H2Icon","H3Icon","H4Icon","H5Icon","H6Icon","createClientComponent","toolbarTextDropdownGroupWithItems","MarkdownTransformer","setHeading","headingSize","selection","iconImports","h1","h2","h3","h4","h5","h6","HeadingFeatureClient","props","clientFeatureProps","feature","enabledHeadingSizes","toolbarGroups","map","i","ChildComponent","isActive","node","getNodes","getTag","parent","getParent","key","label","charAt","onSelect","editor","update","order","markdownTransformers","nodes","slashMenu","groups","length","items","Icon","keywords","toolbarFixed","toolbarInline","HeadingFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,qBAAoB;AACnD,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,qBAAoB;AACpE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAM1D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,iCAAiC,QAAQ,yCAAwC;AAC1F,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,aAAa,CAACC;IAClB,MAAMC,YAAYb;IAClBD,eAAec,WAAW,IAAMhB,mBAAmBe;AACrD;AAEA,MAAME,cAAc;IAClBC,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;IACJc,IAAIb;AACN;AAEA,MAAMc,uBAA2E,CAACC;IAChF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS;YACP,MAAM,EAAEC,sBAAsB;gBAAC;gBAAM;gBAAM;gBAAM;gBAAM;gBAAM;aAAK,EAAE,GAAGH;YAEvE,MAAMI,gBAAgC;gBACpCjB,kCACEgB,oBAAoBE,GAAG,CAAC,CAACf,aAAagB;oBACpC,OAAO;wBACLC,gBAAgBf,WAAW,CAACF,YAAY;wBACxCkB,UAAU,CAAC,EAAEjB,SAAS,EAAE;4BACtB,IAAI,CAACZ,kBAAkBY,YAAY;gCACjC,OAAO;4BACT;4BACA,KAAK,MAAMkB,QAAQlB,UAAUmB,QAAQ,GAAI;gCACvC,IAAIpC,eAAemC,SAASA,KAAKE,MAAM,OAAOrB,aAAa;oCACzD;gCACF;gCAEA,MAAMsB,SAASH,KAAKI,SAAS;gCAC7B,IAAIvC,eAAesC,WAAWA,OAAOD,MAAM,OAAOrB,aAAa;oCAC7D;gCACF;gCAEA,OAAO;4BACT;4BACA,OAAO;wBACT;wBACAwB,KAAKxB;wBACLyB,OAAO,CAAC,QAAQ,EAAEzB,YAAY0B,MAAM,CAAC,GAAG,CAAC;wBACzCC,UAAU,CAAC,EAAEC,MAAM,EAAE;4BACnBA,OAAOC,MAAM,CAAC;gCACZ9B,WAAWC;4BACb;wBACF;wBACA8B,OAAOd,IAAI;oBACb;gBACF;aAEH;YAED,OAAO;gBACLL,oBAAoBD;gBACpBqB,sBAAsB;oBAACjC,oBAAoBe;iBAAqB;gBAChEmB,OAAO;oBAAC9C;iBAAY;gBACpB+C,WAAW;oBACTC,QAAQrB,qBAAqBsB,SACzB;wBACE;4BACEC,OAAOvB,oBAAoBE,GAAG,CAAC,CAACf;gCAC9B,OAAO;oCACLqC,MAAMnC,WAAW,CAACF,YAAY;oCAC9BwB,KAAK,CAAC,QAAQ,EAAExB,YAAY0B,MAAM,CAAC,GAAG,CAAC;oCACvCY,UAAU;wCAAC;wCAAWtC;qCAAY;oCAClCyB,OAAO,CAAC,QAAQ,EAAEzB,YAAY0B,MAAM,CAAC,GAAG,CAAC;oCACzCC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ9B,WAAWC;wCACb;oCACF;gCACF;4BACF;4BACAwB,KAAK;4BACLC,OAAO;wBACT;qBACD,GACD,EAAE;gBACR;gBACAc,cAAc;oBACZL,QAAQrB,qBAAqBsB,SAASrB,gBAAgB,EAAE;gBAC1D;gBACA0B,eAAe;oBACbN,QAAQrB,qBAAqBsB,SAASrB,gBAAgB,EAAE;gBAC1D;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAM2B,gCAAgC7C,sBAAsBa,sBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/horizontalRule/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/horizontalRule/feature.client.tsx"],"names":[],"mappings":";AA2EA,eAAO,MAAM,oCAAoC,+BAEhD,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { $isNodeSelection } from 'lexical';
|
|
2
3
|
import { HorizontalRuleIcon } from '../../lexical/ui/icons/HorizontalRule/index.js';
|
|
3
4
|
import { createClientComponent } from '../createClientComponent.js';
|
|
5
|
+
import { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js';
|
|
4
6
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
5
|
-
import { HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND } from './nodes/HorizontalRuleNode.js';
|
|
7
|
+
import { $isHorizontalRuleNode, HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND } from './nodes/HorizontalRuleNode.js';
|
|
6
8
|
import { HorizontalRulePlugin } from './plugin/index.js';
|
|
7
9
|
const HorizontalRuleFeatureClient = (props)=>{
|
|
8
10
|
return {
|
|
@@ -24,11 +26,9 @@ const HorizontalRuleFeatureClient = (props)=>{
|
|
|
24
26
|
slashMenu: {
|
|
25
27
|
groups: [
|
|
26
28
|
{
|
|
27
|
-
displayName: 'Basic',
|
|
28
29
|
items: [
|
|
29
30
|
{
|
|
30
31
|
Icon: HorizontalRuleIcon,
|
|
31
|
-
displayName: `Horizontal Rule`,
|
|
32
32
|
key: 'horizontalRule',
|
|
33
33
|
keywords: [
|
|
34
34
|
'hr',
|
|
@@ -36,14 +36,37 @@ const HorizontalRuleFeatureClient = (props)=>{
|
|
|
36
36
|
'line',
|
|
37
37
|
'separator'
|
|
38
38
|
],
|
|
39
|
+
label: `Horizontal Rule`,
|
|
39
40
|
onSelect: ({ editor })=>{
|
|
40
41
|
editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
],
|
|
44
|
-
key: 'basic'
|
|
45
|
+
key: 'basic',
|
|
46
|
+
label: 'Basic'
|
|
45
47
|
}
|
|
46
48
|
]
|
|
49
|
+
},
|
|
50
|
+
toolbarFixed: {
|
|
51
|
+
groups: [
|
|
52
|
+
toolbarAddDropdownGroupWithItems([
|
|
53
|
+
{
|
|
54
|
+
ChildComponent: HorizontalRuleIcon,
|
|
55
|
+
isActive: ({ selection })=>{
|
|
56
|
+
if (!$isNodeSelection(selection) || !selection.getNodes().length) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const firstNode = selection.getNodes()[0];
|
|
60
|
+
return $isHorizontalRuleNode(firstNode);
|
|
61
|
+
},
|
|
62
|
+
key: 'horizontalRule',
|
|
63
|
+
label: `Horizontal Rule`,
|
|
64
|
+
onSelect: ({ editor })=>{
|
|
65
|
+
editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
])
|
|
69
|
+
]
|
|
47
70
|
}
|
|
48
71
|
})
|
|
49
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/horizontalRule/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { HorizontalRuleIcon } from '../../lexical/ui/icons/HorizontalRule/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/horizontalRule/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { HorizontalRuleIcon } from '../../lexical/ui/icons/HorizontalRule/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport {\n $isHorizontalRuleNode,\n HorizontalRuleNode,\n INSERT_HORIZONTAL_RULE_COMMAND,\n} from './nodes/HorizontalRuleNode.js'\nimport { HorizontalRulePlugin } from './plugin/index.js'\n\nconst HorizontalRuleFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer],\n nodes: [HorizontalRuleNode],\n plugins: [\n {\n Component: HorizontalRulePlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: [\n {\n Icon: HorizontalRuleIcon,\n key: 'horizontalRule',\n keywords: ['hr', 'horizontal rule', 'line', 'separator'],\n label: `Horizontal Rule`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ],\n key: 'basic',\n label: 'Basic',\n },\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: HorizontalRuleIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isHorizontalRuleNode(firstNode)\n },\n key: 'horizontalRule',\n label: `Horizontal Rule`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const HorizontalRuleFeatureClientComponent = createClientComponent(\n HorizontalRuleFeatureClient,\n)\n"],"names":["$isNodeSelection","HorizontalRuleIcon","createClientComponent","toolbarAddDropdownGroupWithItems","MarkdownTransformer","$isHorizontalRuleNode","HorizontalRuleNode","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRulePlugin","HorizontalRuleFeatureClient","props","clientFeatureProps","feature","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","items","Icon","key","keywords","label","onSelect","editor","dispatchCommand","undefined","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode","HorizontalRuleFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,QAAQ,UAAS;AAI1C,SAASC,kBAAkB,QAAQ,iDAAgD;AACnF,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,gCAAgC,QAAQ,wCAAuC;AACxF,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SACEC,qBAAqB,EACrBC,kBAAkB,EAClBC,8BAA8B,QACzB,gCAA+B;AACtC,SAASC,oBAAoB,QAAQ,oBAAmB;AAExD,MAAMC,8BAAwE,CAACC;IAC7E,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,sBAAsB;oBAACT;iBAAoB;gBAC3CU,OAAO;oBAACR;iBAAmB;gBAC3BS,SAAS;oBACP;wBACEC,WAAWR;wBACXS,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAO;gCACL;oCACEC,MAAMpB;oCACNqB,KAAK;oCACLC,UAAU;wCAAC;wCAAM;wCAAmB;wCAAQ;qCAAY;oCACxDC,OAAO,CAAC,eAAe,CAAC;oCACxBC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAACpB,gCAAgCqB;oCACzD;gCACF;6BACD;4BACDN,KAAK;4BACLE,OAAO;wBACT;qBACD;gBACH;gBACAK,cAAc;oBACZV,QAAQ;wBACNhB,iCAAiC;4BAC/B;gCACE2B,gBAAgB7B;gCAChB8B,UAAU,CAAC,EAAEC,SAAS,EAAE;oCACtB,IAAI,CAAChC,iBAAiBgC,cAAc,CAACA,UAAUC,QAAQ,GAAGC,MAAM,EAAE;wCAChE,OAAO;oCACT;oCAEA,MAAMC,YAAYH,UAAUC,QAAQ,EAAE,CAAC,EAAE;oCACzC,OAAO5B,sBAAsB8B;gCAC/B;gCACAb,KAAK;gCACLE,OAAO,CAAC,eAAe,CAAC;gCACxBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,eAAe,CAACpB,gCAAgCqB;gCACzD;4BACF;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMQ,uCAAuClC,sBAClDO,6BACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/indent/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/indent/feature.client.tsx"],"names":[],"mappings":";AAmEA,eAAO,MAAM,4BAA4B,+BAA6C,CAAA"}
|
|
@@ -3,49 +3,53 @@ import { INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from 'lexical';
|
|
|
3
3
|
import { IndentDecreaseIcon } from '../../lexical/ui/icons/IndentDecrease/index.js';
|
|
4
4
|
import { IndentIncreaseIcon } from '../../lexical/ui/icons/IndentIncrease/index.js';
|
|
5
5
|
import { createClientComponent } from '../createClientComponent.js';
|
|
6
|
-
import {
|
|
6
|
+
import { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js';
|
|
7
|
+
const toolbarGroups = [
|
|
8
|
+
toolbarIndentGroupWithItems([
|
|
9
|
+
{
|
|
10
|
+
ChildComponent: IndentDecreaseIcon,
|
|
11
|
+
isActive: ()=>false,
|
|
12
|
+
isEnabled: ({ selection })=>{
|
|
13
|
+
if (!selection || !selection?.getNodes()?.length) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
for (const node of selection.getNodes()){
|
|
17
|
+
// If at least one node is indented, this should be active
|
|
18
|
+
if ('__indent' in node && node.__indent > 0 || node.getParent() && '__indent' in node.getParent() && node.getParent().__indent > 0) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
},
|
|
24
|
+
key: 'indentDecrease',
|
|
25
|
+
label: `Decrease Indent`,
|
|
26
|
+
onSelect: ({ editor })=>{
|
|
27
|
+
editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined);
|
|
28
|
+
},
|
|
29
|
+
order: 1
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
ChildComponent: IndentIncreaseIcon,
|
|
33
|
+
isActive: ()=>false,
|
|
34
|
+
key: 'indentIncrease',
|
|
35
|
+
label: `Increase Indent`,
|
|
36
|
+
onSelect: ({ editor })=>{
|
|
37
|
+
editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined);
|
|
38
|
+
},
|
|
39
|
+
order: 2
|
|
40
|
+
}
|
|
41
|
+
])
|
|
42
|
+
];
|
|
7
43
|
const IndentFeatureClient = (props)=>{
|
|
8
44
|
return {
|
|
9
45
|
clientFeatureProps: props,
|
|
10
46
|
feature: ()=>({
|
|
11
47
|
clientFeatureProps: props,
|
|
48
|
+
toolbarFixed: {
|
|
49
|
+
groups: toolbarGroups
|
|
50
|
+
},
|
|
12
51
|
toolbarInline: {
|
|
13
|
-
groups:
|
|
14
|
-
indentGroupWithItems([
|
|
15
|
-
{
|
|
16
|
-
ChildComponent: IndentDecreaseIcon,
|
|
17
|
-
isActive: ()=>false,
|
|
18
|
-
isEnabled: ({ selection })=>{
|
|
19
|
-
if (!selection || !selection?.getNodes()?.length) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
for (const node of selection.getNodes()){
|
|
23
|
-
// If at least one node is indented, this should be active
|
|
24
|
-
if ('__indent' in node && node.__indent > 0 || node.getParent() && '__indent' in node.getParent() && node.getParent().__indent > 0) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
},
|
|
30
|
-
key: 'indentDecrease',
|
|
31
|
-
label: `Decrease Indent`,
|
|
32
|
-
onSelect: ({ editor })=>{
|
|
33
|
-
editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined);
|
|
34
|
-
},
|
|
35
|
-
order: 1
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
ChildComponent: IndentIncreaseIcon,
|
|
39
|
-
isActive: ()=>false,
|
|
40
|
-
key: 'indentIncrease',
|
|
41
|
-
label: `Increase Indent`,
|
|
42
|
-
onSelect: ({ editor })=>{
|
|
43
|
-
editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined);
|
|
44
|
-
},
|
|
45
|
-
order: 2
|
|
46
|
-
}
|
|
47
|
-
])
|
|
48
|
-
]
|
|
52
|
+
groups: toolbarGroups
|
|
49
53
|
}
|
|
50
54
|
})
|
|
51
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/indent/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { IndentDecreaseIcon } from '../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/indent/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { IndentDecreaseIcon } from '../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarIndentGroupWithItems([\n {\n ChildComponent: IndentDecreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n if (!selection || !selection?.getNodes()?.length) {\n return false\n }\n for (const node of selection.getNodes()) {\n // If at least one node is indented, this should be active\n if (\n ('__indent' in node && (node.__indent as number) > 0) ||\n (node.getParent() && '__indent' in node.getParent() && node.getParent().__indent > 0)\n ) {\n return true\n }\n }\n return false\n },\n key: 'indentDecrease',\n label: `Decrease Indent`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)\n },\n order: 1,\n },\n {\n ChildComponent: IndentIncreaseIcon,\n isActive: () => false,\n key: 'indentIncrease',\n label: `Increase Indent`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)\n },\n order: 2,\n },\n ]),\n]\n\nconst IndentFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const IndentFeatureClientComponent = createClientComponent(IndentFeatureClient)\n"],"names":["INDENT_CONTENT_COMMAND","OUTDENT_CONTENT_COMMAND","IndentDecreaseIcon","IndentIncreaseIcon","createClientComponent","toolbarIndentGroupWithItems","toolbarGroups","ChildComponent","isActive","isEnabled","selection","getNodes","length","node","__indent","getParent","key","label","onSelect","editor","dispatchCommand","undefined","order","IndentFeatureClient","props","clientFeatureProps","feature","toolbarFixed","groups","toolbarInline","IndentFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,sBAAsB,EAAEC,uBAAuB,QAAQ,UAAS;AAKzE,SAASC,kBAAkB,QAAQ,iDAAgD;AACnF,SAASC,kBAAkB,QAAQ,iDAAgD;AACnF,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,2BAA2B,QAAQ,0BAAyB;AAErE,MAAMC,gBAAgC;IACpCD,4BAA4B;QAC1B;YACEE,gBAAgBL;YAChBM,UAAU,IAAM;YAChBC,WAAW,CAAC,EAAEC,SAAS,EAAE;gBACvB,IAAI,CAACA,aAAa,CAACA,WAAWC,YAAYC,QAAQ;oBAChD,OAAO;gBACT;gBACA,KAAK,MAAMC,QAAQH,UAAUC,QAAQ,GAAI;oBACvC,0DAA0D;oBAC1D,IACE,AAAC,cAAcE,QAAQ,AAACA,KAAKC,QAAQ,GAAc,KAClDD,KAAKE,SAAS,MAAM,cAAcF,KAAKE,SAAS,MAAMF,KAAKE,SAAS,GAAGD,QAAQ,GAAG,GACnF;wBACA,OAAO;oBACT;gBACF;gBACA,OAAO;YACT;YACAE,KAAK;YACLC,OAAO,CAAC,eAAe,CAAC;YACxBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACnB,yBAAyBoB;YAClD;YACAC,OAAO;QACT;QACA;YACEf,gBAAgBJ;YAChBK,UAAU,IAAM;YAChBQ,KAAK;YACLC,OAAO,CAAC,eAAe,CAAC;YACxBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACpB,wBAAwBqB;YACjD;YACAC,OAAO;QACT;KACD;CACF;AAED,MAAMC,sBAAgE,CAACC;IACrE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,cAAc;oBACZC,QAAQtB;gBACV;gBACAuB,eAAe;oBACbD,QAAQtB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMwB,+BAA+B1B,sBAAsBmB,qBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarIndentGroup.d.ts","sourceRoot":"","sources":["../../../../src/field/features/indent/toolbarIndentGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE1E,eAAO,MAAM,2BAA2B,UAAW,gBAAgB,EAAE,KAAG,YAOvE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/indent/toolbarIndentGroup.ts"],"sourcesContent":["import type { ToolbarGroup, ToolbarGroupItem } from '../toolbars/types.js'\n\nexport const toolbarIndentGroupWithItems = (items: ToolbarGroupItem[]): ToolbarGroup => {\n return {\n type: 'buttons',\n items,\n key: 'indent',\n order: 35,\n }\n}\n"],"names":["toolbarIndentGroupWithItems","items","type","key","order"],"rangeMappings":";;;;;;;","mappings":"AAEA,OAAO,MAAMA,8BAA8B,CAACC;IAC1C,OAAO;QACLC,MAAM;QACND;QACAE,KAAK;QACLC,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.client.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AAexE,MAAM,MAAM,WAAW,GAAG,6BAA6B,CAAA;AA4EvD,eAAO,MAAM,0BAA0B,+FAA2C,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { $getSelection, $isRangeSelection } from 'lexical';
|
|
|
4
4
|
import { LinkIcon } from '../../lexical/ui/icons/Link/index.js';
|
|
5
5
|
import { getSelectedNode } from '../../lexical/utils/getSelectedNode.js';
|
|
6
6
|
import { createClientComponent } from '../createClientComponent.js';
|
|
7
|
-
import {
|
|
7
|
+
import { toolbarFeatureButtonsGroupWithItems } from '../shared/toolbar/featureButtonsGroup.js';
|
|
8
8
|
import { AutoLinkNode } from './nodes/AutoLinkNode.js';
|
|
9
9
|
import { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from './nodes/LinkNode.js';
|
|
10
10
|
import { AutoLinkPlugin } from './plugins/autoLink/index.js';
|
|
@@ -12,6 +12,45 @@ import { ClickableLinkPlugin } from './plugins/clickableLink/index.js';
|
|
|
12
12
|
import { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js';
|
|
13
13
|
import { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js';
|
|
14
14
|
import { LinkPlugin } from './plugins/link/index.js';
|
|
15
|
+
const toolbarGroups = [
|
|
16
|
+
toolbarFeatureButtonsGroupWithItems([
|
|
17
|
+
{
|
|
18
|
+
ChildComponent: LinkIcon,
|
|
19
|
+
isActive: ({ selection })=>{
|
|
20
|
+
if ($isRangeSelection(selection)) {
|
|
21
|
+
const selectedNode = getSelectedNode(selection);
|
|
22
|
+
const linkParent = $findMatchingParent(selectedNode, $isLinkNode);
|
|
23
|
+
return linkParent != null;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
},
|
|
27
|
+
key: 'link',
|
|
28
|
+
label: `Link`,
|
|
29
|
+
onSelect: ({ editor, isActive })=>{
|
|
30
|
+
if (!isActive) {
|
|
31
|
+
let selectedText = null;
|
|
32
|
+
editor.getEditorState().read(()=>{
|
|
33
|
+
selectedText = $getSelection().getTextContent();
|
|
34
|
+
});
|
|
35
|
+
const linkFields = {
|
|
36
|
+
doc: null,
|
|
37
|
+
linkType: 'custom',
|
|
38
|
+
newTab: false,
|
|
39
|
+
url: 'https://'
|
|
40
|
+
};
|
|
41
|
+
editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {
|
|
42
|
+
fields: linkFields,
|
|
43
|
+
text: selectedText
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
// remove link
|
|
47
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
order: 1
|
|
51
|
+
}
|
|
52
|
+
])
|
|
53
|
+
];
|
|
15
54
|
const LinkFeatureClient = (props)=>{
|
|
16
55
|
return {
|
|
17
56
|
clientFeatureProps: props,
|
|
@@ -39,46 +78,11 @@ const LinkFeatureClient = (props)=>{
|
|
|
39
78
|
position: 'floatingAnchorElem'
|
|
40
79
|
}
|
|
41
80
|
],
|
|
81
|
+
toolbarFixed: {
|
|
82
|
+
groups: toolbarGroups
|
|
83
|
+
},
|
|
42
84
|
toolbarInline: {
|
|
43
|
-
groups:
|
|
44
|
-
inlineToolbarFeatureButtonsGroupWithItems([
|
|
45
|
-
{
|
|
46
|
-
ChildComponent: LinkIcon,
|
|
47
|
-
isActive: ({ selection })=>{
|
|
48
|
-
if ($isRangeSelection(selection)) {
|
|
49
|
-
const selectedNode = getSelectedNode(selection);
|
|
50
|
-
const linkParent = $findMatchingParent(selectedNode, $isLinkNode);
|
|
51
|
-
return linkParent != null;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
},
|
|
55
|
-
key: 'link',
|
|
56
|
-
label: `Link`,
|
|
57
|
-
onSelect: ({ editor, isActive })=>{
|
|
58
|
-
if (!isActive) {
|
|
59
|
-
let selectedText = null;
|
|
60
|
-
editor.getEditorState().read(()=>{
|
|
61
|
-
selectedText = $getSelection().getTextContent();
|
|
62
|
-
});
|
|
63
|
-
const linkFields = {
|
|
64
|
-
doc: null,
|
|
65
|
-
linkType: 'custom',
|
|
66
|
-
newTab: false,
|
|
67
|
-
url: 'https://'
|
|
68
|
-
};
|
|
69
|
-
editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {
|
|
70
|
-
fields: linkFields,
|
|
71
|
-
text: selectedText
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
// remove link
|
|
75
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
order: 1
|
|
79
|
-
}
|
|
80
|
-
])
|
|
81
|
-
]
|
|
85
|
+
groups: toolbarGroups
|
|
82
86
|
}
|
|
83
87
|
})
|
|
84
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/link/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { ExclusiveLinkCollectionsProps } from './feature.server.js'\nimport type { LinkFields } from './nodes/types.js'\n\nimport { LinkIcon } from '../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../lexical/utils/getSelectedNode.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/link/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { ExclusiveLinkCollectionsProps } from './feature.server.js'\nimport type { LinkFields } from './nodes/types.js'\n\nimport { LinkIcon } from '../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../lexical/utils/getSelectedNode.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarFeatureButtonsGroupWithItems } from '../shared/toolbar/featureButtonsGroup.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from './nodes/LinkNode.js'\nimport { AutoLinkPlugin } from './plugins/autoLink/index.js'\nimport { ClickableLinkPlugin } from './plugins/clickableLink/index.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js'\nimport { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js'\nimport { LinkPlugin } from './plugins/link/index.js'\n\nexport type ClientProps = ExclusiveLinkCollectionsProps\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFeatureButtonsGroupWithItems([\n {\n ChildComponent: LinkIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n const selectedNode = getSelectedNode(selection)\n const linkParent = $findMatchingParent(selectedNode, $isLinkNode)\n return linkParent != null\n }\n return false\n },\n key: 'link',\n label: `Link`,\n onSelect: ({ editor, isActive }) => {\n if (!isActive) {\n let selectedText = null\n editor.getEditorState().read(() => {\n selectedText = $getSelection().getTextContent()\n })\n const linkFields: LinkFields = {\n doc: null,\n linkType: 'custom',\n newTab: false,\n url: 'https://',\n }\n editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {\n fields: linkFields,\n text: selectedText,\n })\n } else {\n // remove link\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }\n },\n order: 1,\n },\n ]),\n]\n\nconst LinkFeatureClient: FeatureProviderProviderClient<ClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [LinkNode, AutoLinkNode],\n plugins: [\n {\n Component: LinkPlugin,\n position: 'normal',\n },\n {\n Component: AutoLinkPlugin,\n position: 'normal',\n },\n {\n Component: ClickableLinkPlugin,\n position: 'normal',\n },\n {\n Component: FloatingLinkEditorPlugin,\n position: 'floatingAnchorElem',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const LinkFeatureClientComponent = createClientComponent(LinkFeatureClient)\n"],"names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","createClientComponent","toolbarFeatureButtonsGroupWithItems","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","FloatingLinkEditorPlugin","LinkPlugin","toolbarGroups","ChildComponent","isActive","selection","selectedNode","linkParent","key","label","onSelect","editor","selectedText","getEditorState","read","getTextContent","linkFields","doc","linkType","newTab","url","dispatchCommand","fields","text","order","LinkFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","toolbarFixed","groups","toolbarInline","LinkFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,mBAAmB,QAAQ,iBAAgB;AACpD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAO1D,SAASC,QAAQ,QAAQ,uCAAsC;AAC/D,SAASC,eAAe,QAAQ,yCAAwC;AACxE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mCAAmC,QAAQ,2CAA0C;AAC9F,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,WAAW,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ,sBAAqB;AAChF,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,mBAAmB,QAAQ,mCAAkC;AACtE,SAASC,8BAA8B,QAAQ,sDAAqD;AACpG,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,UAAU,QAAQ,0BAAyB;AAIpD,MAAMC,gBAAgC;IACpCV,oCAAoC;QAClC;YACEW,gBAAgBd;YAChBe,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAIjB,kBAAkBiB,YAAY;oBAChC,MAAMC,eAAehB,gBAAgBe;oBACrC,MAAME,aAAarB,oBAAoBoB,cAAcZ;oBACrD,OAAOa,cAAc;gBACvB;gBACA,OAAO;YACT;YACAC,KAAK;YACLC,OAAO,CAAC,IAAI,CAAC;YACbC,UAAU,CAAC,EAAEC,MAAM,EAAEP,QAAQ,EAAE;gBAC7B,IAAI,CAACA,UAAU;oBACb,IAAIQ,eAAe;oBACnBD,OAAOE,cAAc,GAAGC,IAAI,CAAC;wBAC3BF,eAAezB,gBAAgB4B,cAAc;oBAC/C;oBACA,MAAMC,aAAyB;wBAC7BC,KAAK;wBACLC,UAAU;wBACVC,QAAQ;wBACRC,KAAK;oBACP;oBACAT,OAAOU,eAAe,CAACtB,gCAAgC;wBACrDuB,QAAQN;wBACRO,MAAMX;oBACR;gBACF,OAAO;oBACL,cAAc;oBACdD,OAAOU,eAAe,CAACzB,qBAAqB;gBAC9C;YACF;YACA4B,OAAO;QACT;KACD;CACF;AAED,MAAMC,oBAAgE,CAACC;IACrE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAAClC;oBAAUF;iBAAa;gBAC/BqC,SAAS;oBACP;wBACEC,WAAW9B;wBACX+B,UAAU;oBACZ;oBACA;wBACED,WAAWlC;wBACXmC,UAAU;oBACZ;oBACA;wBACED,WAAWjC;wBACXkC,UAAU;oBACZ;oBACA;wBACED,WAAW/B;wBACXgC,UAAU;oBACZ;iBACD;gBACDC,cAAc;oBACZC,QAAQhC;gBACV;gBACAiC,eAAe;oBACbD,QAAQhC;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMkC,6BAA6B7C,sBAAsBkC,mBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI1D,eAAO,MAAM,wBAAwB,UAC5B,sBAAsB,KAC5B,kBAAkB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI1D,eAAO,MAAM,wBAAwB,UAC5B,sBAAsB,KAC5B,kBAAkB,kBAAkB,CA2CtC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { recurseNestedFields } from '../../../populate/recurseNestedFields.js';
|
|
2
2
|
export const linkPopulationPromiseHOC = (props)=>{
|
|
3
|
-
return ({ context, currentDepth, depth, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields })=>{
|
|
3
|
+
return ({ context, currentDepth, depth, draft, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields })=>{
|
|
4
4
|
if (!props.fields?.length) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
@@ -12,6 +12,7 @@ export const linkPopulationPromiseHOC = (props)=>{
|
|
|
12
12
|
currentDepth,
|
|
13
13
|
data: node.fields,
|
|
14
14
|
depth,
|
|
15
|
+
draft,
|
|
15
16
|
editorPopulationPromises,
|
|
16
17
|
fieldPromises,
|
|
17
18
|
fields: props.fields,
|