@sit-onyx/tiptap 0.3.0 → 0.3.1-dev-20260826081244
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/LICENSE.txt +1 -1
- package/README.md +2 -2
- package/dist/component-meta.json +1 -1
- package/dist/components/OnyxTextEditor/types.d.ts +8 -6
- package/dist/index.js +153 -194
- package/dist/style.css +1 -1
- package/dist/utils/storybook.d.ts +7 -4
- package/package.json +35 -35
package/LICENSE.txt
CHANGED
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
|
|
176
176
|
END OF TERMS AND CONDITIONS
|
|
177
177
|
|
|
178
|
-
Copyright 2023 Schwarz IT KG
|
|
178
|
+
Copyright 2023 Schwarz Digits IT KG
|
|
179
179
|
|
|
180
180
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
181
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<div align="center" style="text-align: center">
|
|
2
|
-
|
|
2
|
+
<img alt="Onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/packages/assets/src/onyx-brand/signet.svg" height="96px">
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
|
7
7
|
# @sit-onyx/tiptap
|
|
8
8
|
|
|
9
|
-
A rich text editor powered by the Tiptap editor and the onyx design system created by [Schwarz
|
|
9
|
+
A rich text editor powered by the Tiptap editor and the onyx design system created by [Schwarz Digits](https://schwarz-digits.de).
|
|
10
10
|
|
|
11
11
|
<br />
|
|
12
12
|
|
package/dist/component-meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"exportName":"default","displayName":"OnyxEditorToolbarFlyout","type":1,"props":[{"name":"label","global":false,"description":"Label for the flyout button.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"icon","global":false,"description":"Icon for the flyout button.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"options","global":false,"description":"List of available options.","tags":[],"required":true,"type":"EditorToolbarFlyoutOption[]","schema":"EditorToolbarFlyoutOption[]","declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"OnyxEditorToolbarGroup","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"Toolbar actions related to this group.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"OnyxEditorToolbarAction","type":1,"props":[{"name":"label","global":false,"description":"Button label / text to show. Is always required (even if `icon` is set) for screen readers / accessibility.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"disabled","global":false,"description":"If the button should be disabled or not.","tags":[],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"icon","global":false,"description":"Icon to show. Will visually hide the label if set.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"active","global":false,"description":"Whether the action is currently active.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"Optional slot to override the button content.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"OnyxTextEditor","type":1,"props":[{"name":"requiredMarker","global":false,"default":"FORM_INJECTED_SYMBOL","description":"How to display the required / optional marker.\n- optional: will show an `(optional)` text after the label for optional form elements.\n- required: will show an `*` indicator for required inputs after the label instead.\n\nNo marker will be visible if the label is hidden.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component or `required` if none exists"}],"required":false,"type":"FormInjected<\"required\" | \"optional\"> | undefined","schema":{"kind":"enum","type":"FormInjected<\"required\" | \"optional\"> | undefined","schema":["undefined","symbol","\"required\"","\"optional\""]},"declarations":[]},{"name":"reserveMessageSpace","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Always reserves the space required to show `error` or other messages.\nSubsequently this will increase the height of the form element permanently.\nWe recommend to enable this to avoid layout shifts.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component, defaults to `false` otherwise"}],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"showError","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Configures if and when errors are shown.\n- `true`: errors will be shown initially.\n- `false`: errors will never be shown. ⚠️ Only the displaying of the error is effected! An error can still block submission!\n- \"touched\": only shows an error *after* a user has significantly interacted with the input, see [\\:user-invalid](https://drafts.csswg.org/selectors/#user-invalid-pseudo)","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component or `touched` if none exists"}],"required":false,"type":"FormInjected<ShowErrorMode> | undefined","schema":{"kind":"enum","type":"FormInjected<ShowErrorMode> | undefined","schema":["undefined","false","true","symbol","\"touched\""]},"declarations":[]},{"name":"density","global":false,"description":"Density defines the amount of vertical white space a component has and the height of the main (interactive) element of a component.","tags":[{"name":"default","text":"undefined By default the parents setting is used, if none is defined on any parent `default` is the default."}],"required":false,"type":"\"default\" | \"compact\" | \"cozy\" | undefined","schema":{"kind":"enum","type":"\"default\" | \"compact\" | \"cozy\" | undefined","schema":["undefined","\"default\"","\"compact\"","\"cozy\""]},"declarations":[]},{"name":"label","global":false,"description":"Label to show for the element. Required due to accessibility / screen readers.\nIf you want to visually hide the label, use the `label.hidden` property.","tags":[],"required":true,"type":"string | FormElementV2LabelOptions","schema":{"kind":"enum","type":"string | FormElementV2LabelOptions","schema":["string",{"kind":"object","type":"FormElementV2LabelOptions","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},"position":{"name":"position","global":false,"description":"How to position the label relative to the main content.","tags":[],"required":false,"type":"\"top\" | \"left\" | \"right\" | undefined","schema":{"kind":"enum","type":"\"top\" | \"left\" | \"right\" | undefined","schema":["undefined","\"top\"","\"left\"","\"right\""]},"declarations":[]},"hidden":{"name":"hidden","global":false,"description":"If `true`, the label will be visually hidden.\nFor accessibility / screen readers, the aria-label will still be set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]}}}]},"declarations":[]},{"name":"skeleton","global":false,"default":"SKELETON_INJECTED_SYMBOL","description":"Whether to show as skeleton.","tags":[],"required":false,"type":"SkeletonInjected | undefined","schema":{"kind":"enum","type":"SkeletonInjected | undefined","schema":["undefined","number","false","true","symbol"]},"declarations":[]},{"name":"message","global":false,"description":"Optional message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"error","global":false,"description":"Optional error message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"success","global":false,"description":"Optional success message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"required","global":false,"description":"Whether the a value for this form element is required.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"loading","global":false,"description":"Whether a loading indicator should be shown.\nWill hide the `leadingIcons` slot if set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"disabled","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Whether the input should be disabled and prevent the user from interacting with it.\nDisabled makes the element not mutable, focusable, or even submitted with the form.\nIt will also not be validated.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component, defaults to `false` otherwise"}],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"autofocus","global":false,"description":"Whether to focus the component on page load or inside a dialog/popover once it opens.\nCan only be enabled for one element inside a page/dialog/popover.\nNote: Has no effect when set after the component has been mounted.\n\n**UX / Accessibility**: autofocus should be used carefully since it can reduce usability and accessibility for users.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"placeholder","global":false,"description":"Placeholder to show when the value is empty.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"withCounter","global":false,"description":"If `true`, a character counter will be displayed if `maxLength` is set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"disableManualResize","global":false,"description":"If `true`, the user will not be able to manually resize the textarea by dragging the bottom right corner.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"autosize","global":false,"description":"Override the default autosize behavior (height adjusts based on the current value).\nBy default, the textarea will autosize while maintaining at least 3 and at most 10 rows.\nIf the user resizes the textarea manually, the autosize will no longer work and the height\nset by the user is used.","tags":[],"required":false,"type":"TextareaAutosize | undefined","schema":{"kind":"enum","type":"TextareaAutosize | undefined","schema":["undefined",{"kind":"object","type":"TextareaAutosize","schema":{"min":{"name":"min","global":false,"description":"Sets the min height to the given number of rows/lines.\nMust be `>= 2`. Will also be considered if the user resizes manually.","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]},"max":{"name":"max","global":false,"description":"Sets the max height to the given number of rows/lines.\nIf omitted, the textarea can grow unlimited.\nWill be ignored if the user resizes manually.","tags":[],"required":false,"type":"number | undefined","schema":"number | undefined","declarations":[]}}}]},"declarations":[]},{"name":"modelValue","global":false,"description":"Current editor value.","tags":[],"required":false,"type":"Nullable<string>","schema":{"kind":"enum","type":"Nullable<string>","schema":["undefined","null","string"]},"declarations":[]},{"name":"toolbar","global":false,"default":"{ position: \"top\" }","description":"Toolbar config.","tags":[],"required":false,"type":"ToolbarOptions | undefined","schema":{"kind":"enum","type":"ToolbarOptions | undefined","schema":["undefined",{"kind":"object","type":"ToolbarOptions","schema":{"position":{"name":"position","global":false,"description":"How to position the toolbar.","tags":[{"name":"default","text":"\"top\""}],"required":false,"type":"\"top\" | \"bottom\" | undefined","schema":{"kind":"enum","type":"\"top\" | \"bottom\" | undefined","schema":["undefined","\"top\"","\"bottom\""]},"declarations":[]}}}]},"declarations":[]},{"name":"extensions","global":false,"default":"[OnyxStarterKit]","description":"Tiptap extensions to use. Should not be changed dynamically.\nIf set, default extensions will be overridden. Use or configure the OnyxStarterKit in this case.","tags":[],"required":false,"type":"Extensions | undefined","schema":{"kind":"enum","type":"Extensions | undefined","schema":["undefined","Extensions"]},"declarations":[]},{"name":"minlength","global":false,"description":"Minimum number of characters that have to to be entered.\nCharacter count is determined using Tiptap's [CharacterCount extension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]},{"name":"maxlength","global":false,"description":"Maximum number of characters that are allowed to be entered.\nCharacter count is determined using Tiptap's [CharacterCount extension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]}],"events":[{"name":"update:modelValue","description":"Emitted when the value of the editor changes.","tags":[],"type":"[value: string]","signature":"(event: \"update:modelValue\", value: string): void","schema":["string"],"declarations":[]}],"slots":[{"name":"actions","type":"any","description":"Optional slot to add custom actions to the toolbar.","tags":[],"schema":"any","declarations":[]}],"exposed":[{"name":"editor","type":"Editor | undefined","description":"Tiptap editor instance.","tags":[],"schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}]},{"exportName":"default","displayName":"EditorToolbar","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"Optional slot to add custom actions to the toolbar.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ListToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"LinkToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"HeadingToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]}]
|
|
1
|
+
[{"exportName":"default","displayName":"OnyxEditorToolbarAction","type":1,"props":[{"name":"label","global":false,"description":"Button label / text to show. Is always required (even if `icon` is set) for screen readers /\naccessibility.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"disabled","global":false,"description":"If the button should be disabled or not.","tags":[],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"icon","global":false,"description":"Icon to show. Will visually hide the label if set.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"active","global":false,"description":"Whether the action is currently active.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"Optional slot to override the button content.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"OnyxEditorToolbarFlyout","type":1,"props":[{"name":"label","global":false,"description":"Label for the flyout button.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"icon","global":false,"description":"Icon for the flyout button.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},{"name":"options","global":false,"description":"List of available options.","tags":[],"required":true,"type":"EditorToolbarFlyoutOption[]","schema":"EditorToolbarFlyoutOption[]","declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"OnyxEditorToolbarGroup","type":1,"props":[],"events":[],"slots":[{"name":"default","type":"any","description":"Toolbar actions related to this group.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"OnyxTextEditor","type":1,"props":[{"name":"requiredMarker","global":false,"default":"FORM_INJECTED_SYMBOL","description":"How to display the required / optional marker.\n\n- Optional: will show an `(optional)` text after the label for optional form elements.\n- Required: will show an `*` indicator for required inputs after the label instead.\n\nNo marker will be visible if the label is hidden.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component or `required` if none exists"}],"required":false,"type":"FormInjected<\"required\" | \"optional\"> | undefined","schema":{"kind":"enum","type":"FormInjected<\"required\" | \"optional\"> | undefined","schema":["undefined","symbol","\"required\"","\"optional\""]},"declarations":[]},{"name":"reserveMessageSpace","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Always reserves the space required to show `error` or other messages.\nSubsequently this will increase the height of the form element permanently.\nWe recommend to enable this to avoid layout shifts.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component, defaults to `false` otherwise"}],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"showError","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Configures if and when errors are shown.\n\n- `true`: errors will be shown initially.\n- `false`: errors will never be shown. ⚠️ Only the displaying of the error is effected! An error\n can still block submission!\n- \"touched\": only shows an error _after_ a user has significantly interacted with the input, see\n [:user-invalid](https://drafts.csswg.org/selectors/#user-invalid-pseudo)","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component or `touched` if none exists"}],"required":false,"type":"FormInjected<ShowErrorMode> | undefined","schema":{"kind":"enum","type":"FormInjected<ShowErrorMode> | undefined","schema":["undefined","false","true","symbol","\"touched\""]},"declarations":[]},{"name":"density","global":false,"description":"Density defines the amount of vertical white space a component has and the height of the main\n(interactive) element of a component.","tags":[{"name":"default","text":"undefined By default the parents setting is used, if none is defined on any parent `default` is the default."}],"required":false,"type":"\"default\" | \"compact\" | \"cozy\" | undefined","schema":{"kind":"enum","type":"\"default\" | \"compact\" | \"cozy\" | undefined","schema":["undefined","\"default\"","\"compact\"","\"cozy\""]},"declarations":[]},{"name":"label","global":false,"description":"Label to show for the element. Required due to accessibility / screen readers.\nIf you want to visually hide the label, use the `label.hidden` property.","tags":[],"required":true,"type":"string | FormElementV2LabelOptions","schema":{"kind":"enum","type":"string | FormElementV2LabelOptions","schema":["string",{"kind":"object","type":"FormElementV2LabelOptions","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},"position":{"name":"position","global":false,"description":"How to position the label relative to the main content.","tags":[],"required":false,"type":"\"top\" | \"left\" | \"right\" | undefined","schema":{"kind":"enum","type":"\"top\" | \"left\" | \"right\" | undefined","schema":["undefined","\"top\"","\"left\"","\"right\""]},"declarations":[]},"hidden":{"name":"hidden","global":false,"description":"If `true`, the label will be visually hidden.\nFor accessibility / screen readers, the aria-label will still be set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},"truncation":{"name":"truncation","global":false,"description":"How to truncate the label if it exceeds the max width.","tags":[],"required":false,"type":"\"ellipsis\" | \"multiline\" | undefined","schema":{"kind":"enum","type":"\"ellipsis\" | \"multiline\" | undefined","schema":["undefined","\"ellipsis\"","\"multiline\""]},"declarations":[]}}}]},"declarations":[]},{"name":"skeleton","global":false,"default":"SKELETON_INJECTED_SYMBOL","description":"Whether to show as skeleton.","tags":[],"required":false,"type":"SkeletonInjected | undefined","schema":{"kind":"enum","type":"SkeletonInjected | undefined","schema":["undefined","number","false","true","symbol"]},"declarations":[]},{"name":"message","global":false,"description":"Optional message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"error","global":false,"description":"Optional error message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"success","global":false,"description":"Optional success message to show below the form element.","tags":[],"required":false,"type":"string | FormElementV2Tooltip | undefined","schema":{"kind":"enum","type":"string | FormElementV2Tooltip | undefined","schema":["undefined","string",{"kind":"object","type":"FormElementV2Tooltip","schema":{"label":{"name":"label","global":false,"description":"Label displayed outside of the tooltip.","tags":[],"required":true,"type":"string","schema":"string","declarations":[]},"tooltipText":{"name":"tooltipText","global":false,"description":"Actual tooltip text.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]}}}]},"declarations":[]},{"name":"required","global":false,"description":"Whether the a value for this form element is required.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"loading","global":false,"description":"Whether a loading indicator should be shown.\nWill hide the `leadingIcons` slot if set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"disabled","global":false,"default":"FORM_INJECTED_SYMBOL","description":"Whether the input should be disabled and prevent the user from interacting with it.\nDisabled makes the element not mutable, focusable, or even submitted with the form.\nIt will also not be validated.","tags":[{"name":"default","text":"Inherits value from closest `<OnyxForm>` component, defaults to `false` otherwise"}],"required":false,"type":"FormInjected<boolean> | undefined","schema":{"kind":"enum","type":"FormInjected<boolean> | undefined","schema":["undefined","false","true","symbol"]},"declarations":[]},{"name":"autofocus","global":false,"description":"Whether to focus the component on page load or inside a dialog/popover once it opens.\nCan only be enabled for one element inside a page/dialog/popover.\nNote: Has no effect when set after the component has been mounted.\n\n**UX / Accessibility**: autofocus should be used carefully since it can reduce usability and\naccessibility for users.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"placeholder","global":false,"description":"Placeholder to show when the value is empty.","tags":[],"required":false,"type":"string | undefined","schema":{"kind":"enum","type":"string | undefined","schema":["undefined","string"]},"declarations":[]},{"name":"withCounter","global":false,"description":"If `true`, a character counter will be displayed if `maxLength` is set.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"disableManualResize","global":false,"description":"If `true`, the user will not be able to manually resize the textarea by dragging the bottom\nright corner.","tags":[],"required":false,"type":"boolean | undefined","schema":{"kind":"enum","type":"boolean | undefined","schema":["undefined","false","true"]},"declarations":[]},{"name":"autosize","global":false,"description":"Override the default autosize behavior (height adjusts based on the current value).\nBy default, the textarea will autosize while maintaining at least 3 and at most 10 rows.\nIf the user resizes the textarea manually, the autosize will no longer work and the height\nset by the user is used.","tags":[],"required":false,"type":"TextareaAutosize | undefined","schema":{"kind":"enum","type":"TextareaAutosize | undefined","schema":["undefined",{"kind":"object","type":"TextareaAutosize","schema":{"min":{"name":"min","global":false,"description":"Sets the min height to the given number of rows/lines.\nMust be `>= 2`. Will also be considered if the user resizes manually.","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]},"max":{"name":"max","global":false,"description":"Sets the max height to the given number of rows/lines.\nIf omitted, the textarea can grow unlimited.\nWill be ignored if the user resizes manually.","tags":[],"required":false,"type":"number | undefined","schema":"number | undefined","declarations":[]}}}]},"declarations":[]},{"name":"modelValue","global":false,"description":"Current editor value.","tags":[],"required":false,"type":"Nullable<string>","schema":{"kind":"enum","type":"Nullable<string>","schema":["undefined","null","string"]},"declarations":[]},{"name":"toolbar","global":false,"default":"{ position: \"top\" }","description":"Toolbar config.","tags":[],"required":false,"type":"ToolbarOptions | undefined","schema":{"kind":"enum","type":"ToolbarOptions | undefined","schema":["undefined",{"kind":"object","type":"ToolbarOptions","schema":{"position":{"name":"position","global":false,"description":"How to position the toolbar.","tags":[{"name":"default","text":"\"top\""}],"required":false,"type":"\"top\" | \"bottom\" | undefined","schema":{"kind":"enum","type":"\"top\" | \"bottom\" | undefined","schema":["undefined","\"top\"","\"bottom\""]},"declarations":[]}}}]},"declarations":[]},{"name":"extensions","global":false,"default":"[OnyxStarterKit]","description":"Tiptap extensions to use. Should not be changed dynamically. If set, default extensions will\nbe overridden. Use or configure the OnyxStarterKit in this case.","tags":[],"required":false,"type":"Extensions | undefined","schema":{"kind":"enum","type":"Extensions | undefined","schema":["undefined","Extensions"]},"declarations":[]},{"name":"minlength","global":false,"description":"Minimum number of characters that have to to be entered. Character count is determined using\nTiptap's [CharacterCount\nextension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]},{"name":"maxlength","global":false,"description":"Maximum number of characters that are allowed to be entered. Character count is determined\nusing Tiptap's [CharacterCount\nextension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).","tags":[],"required":false,"type":"number | undefined","schema":{"kind":"enum","type":"number | undefined","schema":["undefined","number"]},"declarations":[]}],"events":[{"name":"update:modelValue","description":"Emitted when the value of the editor changes.","tags":[],"type":"[value: string]","signature":"(event: \"update:modelValue\", value: string): void","schema":["string"],"declarations":[]}],"slots":[{"name":"actions","type":"any","description":"Optional slot to add custom actions to the toolbar.","tags":[],"schema":"any","declarations":[]}],"exposed":[{"name":"editor","type":"Editor | undefined","description":"Tiptap editor instance.","tags":[],"schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}]},{"exportName":"default","displayName":"EditorToolbar","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[{"name":"default","type":"any","description":"Optional slot to add custom actions to the toolbar.","tags":[],"schema":"any","declarations":[]}],"exposed":[]},{"exportName":"default","displayName":"ListToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"HeadingToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]},{"exportName":"default","displayName":"LinkToolbarAction","type":1,"props":[{"name":"editor","global":false,"description":"","tags":[],"required":false,"type":"Editor | undefined","schema":{"kind":"enum","type":"Editor | undefined","schema":["undefined","Editor"]},"declarations":[]}],"events":[],"slots":[],"exposed":[]}]
|
|
@@ -11,18 +11,20 @@ export type OnyxTextEditorProps = Omit<OnyxFormElementV2Props, "open" | "popover
|
|
|
11
11
|
*/
|
|
12
12
|
toolbar?: ToolbarOptions;
|
|
13
13
|
/**
|
|
14
|
-
* Tiptap extensions to use. Should not be changed dynamically.
|
|
15
|
-
*
|
|
14
|
+
* Tiptap extensions to use. Should not be changed dynamically. If set, default extensions will
|
|
15
|
+
* be overridden. Use or configure the OnyxStarterKit in this case.
|
|
16
16
|
*/
|
|
17
17
|
extensions?: Extensions;
|
|
18
18
|
/**
|
|
19
|
-
* Minimum number of characters that have to to be entered.
|
|
20
|
-
*
|
|
19
|
+
* Minimum number of characters that have to to be entered. Character count is determined using
|
|
20
|
+
* Tiptap's [CharacterCount
|
|
21
|
+
* extension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).
|
|
21
22
|
*/
|
|
22
23
|
minlength?: number;
|
|
23
24
|
/**
|
|
24
|
-
* Maximum number of characters that are allowed to be entered.
|
|
25
|
-
*
|
|
25
|
+
* Maximum number of characters that are allowed to be entered. Character count is determined
|
|
26
|
+
* using Tiptap's [CharacterCount
|
|
27
|
+
* extension](https://tiptap.dev/docs/editor/extensions/functionality/character-count).
|
|
26
28
|
*/
|
|
27
29
|
maxlength?: number;
|
|
28
30
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createSlots as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, mergeProps as f, normalizeClass as p, openBlock as m, provide as ee, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRef as y, unref as b,
|
|
1
|
+
import { Fragment as e, Teleport as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createSlots as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, mergeProps as f, normalizeClass as p, openBlock as m, provide as ee, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRef as y, unref as b, useSlots as x, useTemplateRef as S, watch as C, watchEffect as te, withCtx as w } from "vue";
|
|
2
2
|
import { Placeholder as ne } from "@tiptap/extensions/placeholder";
|
|
3
|
-
import { EditorContent as re, Extension as
|
|
4
|
-
import { FORM_INJECTED_SYMBOL as
|
|
5
|
-
import { iconAlignmentBlock as
|
|
6
|
-
import
|
|
7
|
-
import { CharacterCount as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import { EditorContent as re, Extension as T, mergeAttributes as E, useEditor as ie } from "@tiptap/vue-3";
|
|
4
|
+
import { FORM_INJECTED_SYMBOL as D, OnyxFlyoutMenu as O, OnyxIcon as k, OnyxMenuItem as A, OnyxSystemButton as j, OnyxTooltip as M, OnyxUnstableEditLinkDialog as N, OnyxUnstableFormElementV2 as P, OnyxVisuallyHidden as ae, SKELETON_INJECTED_SYMBOL as F, injectI18n as I, mergeVueProps as L, useFormContext as oe, useForwardProps as R, useRootAttrs as z, useVModel as se, useWhitespaceValidation as ce } from "sit-onyx";
|
|
5
|
+
import { iconAlignmentBlock as B, iconAlignmentCenter as V, iconAlignmentLeft as H, iconAlignmentRight as le, iconBulletList as U, iconChevronDownSmall as W, iconH1 as ue, iconH2 as de, iconH3 as fe, iconH4 as pe, iconLink as me, iconList as he, iconNumberedList as ge, iconParagraphText as G, iconQuote as _e, iconRedo as ve, iconToolBold as ye, iconToolItalic as be, iconToolStrike as xe, iconToolUnderlined as Se, iconUndo as Ce } from "@sit-onyx/icons";
|
|
6
|
+
import we from "@tiptap/extension-text-align";
|
|
7
|
+
import { CharacterCount as Te } from "@tiptap/extensions";
|
|
8
|
+
import Ee from "@tiptap/starter-kit";
|
|
9
|
+
import De from "@tiptap/extension-heading";
|
|
10
10
|
//#region src/composables/useEditorUtils.ts
|
|
11
11
|
var K = (e) => ({
|
|
12
|
-
hasExtension: n(() => (t) => e.value
|
|
12
|
+
hasExtension: n(() => (t) => !e.value || e.value.extensionManager.extensions.some((e) => e.name === t)),
|
|
13
13
|
hasTextExtension: n(() => (t) => {
|
|
14
14
|
if (!e.value) return !0;
|
|
15
15
|
let n = e.value.extensionManager.extensions.find((e) => e.name === "textAlign");
|
|
@@ -30,27 +30,27 @@ var K = (e) => ({
|
|
|
30
30
|
active: { type: Boolean }
|
|
31
31
|
},
|
|
32
32
|
setup(e) {
|
|
33
|
-
let t = e, n =
|
|
34
|
-
return (e, s) => (m(), r(b(
|
|
33
|
+
let t = e, n = R(t, j), i = d(q, void 0), { restAttrs: a, rootAttrs: o } = z();
|
|
34
|
+
return (e, s) => (m(), r(b(M), f(b(o), {
|
|
35
35
|
class: "onyx-editor-toolbar-action",
|
|
36
36
|
text: t.label,
|
|
37
37
|
position: "top"
|
|
38
38
|
}), {
|
|
39
|
-
default:
|
|
39
|
+
default: w(({ trigger: r }) => [l(b(j), f(b(L)(b(n), r, b(a)), {
|
|
40
40
|
disabled: t.disabled || b(i)?.disabled.value,
|
|
41
41
|
class: { active: t.active },
|
|
42
42
|
title: ""
|
|
43
43
|
}), {
|
|
44
|
-
default:
|
|
44
|
+
default: w(() => [_(e.$slots, "default")]),
|
|
45
45
|
_: 3
|
|
46
46
|
}, 16, ["disabled", "class"])]),
|
|
47
47
|
_: 3
|
|
48
48
|
}, 16, ["text"]));
|
|
49
49
|
}
|
|
50
|
-
}),
|
|
50
|
+
}), Oe = { class: /*@__PURE__*/ p(["onyx-component", "onyx-editor-toolbar-group"]) }, Y = /* @__PURE__ */ u({
|
|
51
51
|
__name: "OnyxEditorToolbarGroup",
|
|
52
52
|
setup(e) {
|
|
53
|
-
return (e, t) => (m(), a("div",
|
|
53
|
+
return (e, t) => (m(), a("div", Oe, [_(e.$slots, "default")]));
|
|
54
54
|
}
|
|
55
55
|
}), X = /* @__PURE__ */ u({
|
|
56
56
|
__name: "OnyxEditorToolbarFlyout",
|
|
@@ -61,18 +61,18 @@ var K = (e) => ({
|
|
|
61
61
|
},
|
|
62
62
|
setup(t) {
|
|
63
63
|
let o = t, s = d(q, void 0), u = n(() => o.options.find((e) => e.active)), p = n(() => u.value?.icon ?? o.icon);
|
|
64
|
-
return (t, n) => (m(), r(b(
|
|
64
|
+
return (t, n) => (m(), r(b(O), {
|
|
65
65
|
label: o.label,
|
|
66
66
|
disabled: b(s)?.disabled.value
|
|
67
67
|
}, {
|
|
68
|
-
button:
|
|
68
|
+
button: w(({ trigger: e }) => [l(J, f(e, {
|
|
69
69
|
label: o.label,
|
|
70
70
|
icon: p.value,
|
|
71
71
|
active: !!u.value
|
|
72
72
|
}), {
|
|
73
|
-
default:
|
|
73
|
+
default: w(() => [l(b(k), { icon: p.value }, null, 8, ["icon"]), l(b(k), {
|
|
74
74
|
class: "onyx-editor-toolbar-flyout__chevron",
|
|
75
|
-
icon: b(
|
|
75
|
+
icon: b(W)
|
|
76
76
|
}, null, 8, ["icon"])]),
|
|
77
77
|
_: 1
|
|
78
78
|
}, 16, [
|
|
@@ -80,12 +80,12 @@ var K = (e) => ({
|
|
|
80
80
|
"icon",
|
|
81
81
|
"active"
|
|
82
82
|
])]),
|
|
83
|
-
options:
|
|
83
|
+
options: w(() => [(m(!0), a(e, null, g(o.options, (e) => (m(), r(b(A), {
|
|
84
84
|
key: e.label,
|
|
85
85
|
active: e.active,
|
|
86
86
|
onClick: (t) => e.onClick?.()
|
|
87
87
|
}, {
|
|
88
|
-
default:
|
|
88
|
+
default: w(() => [e.icon ? (m(), r(b(k), {
|
|
89
89
|
key: 0,
|
|
90
90
|
class: "onyx-editor-toolbar-flyout__icon",
|
|
91
91
|
icon: e.icon
|
|
@@ -95,17 +95,17 @@ var K = (e) => ({
|
|
|
95
95
|
_: 1
|
|
96
96
|
}, 8, ["label", "disabled"]));
|
|
97
97
|
}
|
|
98
|
-
}),
|
|
98
|
+
}), ke = /* @__PURE__ */ u({
|
|
99
99
|
__name: "HeadingToolbarAction",
|
|
100
100
|
props: { editor: {} },
|
|
101
101
|
setup(e) {
|
|
102
|
-
let t = e, { t: i } =
|
|
102
|
+
let t = e, { t: i } = I(), { hasHeadingLevelExtension: a } = K(y(t, "editor")), o = (e) => {
|
|
103
103
|
t.editor?.chain().focus().toggleHeading({ level: e }).run();
|
|
104
104
|
}, s = n(() => (e) => t.editor?.isActive("heading", { level: e })), c = {
|
|
105
|
-
1:
|
|
106
|
-
2:
|
|
107
|
-
3:
|
|
108
|
-
4:
|
|
105
|
+
1: ue,
|
|
106
|
+
2: de,
|
|
107
|
+
3: fe,
|
|
108
|
+
4: pe
|
|
109
109
|
}, l = n(() => {
|
|
110
110
|
let e = [];
|
|
111
111
|
for (let t = 0; t < 6; t++) {
|
|
@@ -134,52 +134,45 @@ var K = (e) => ({
|
|
|
134
134
|
"options"
|
|
135
135
|
]));
|
|
136
136
|
}
|
|
137
|
-
}),
|
|
137
|
+
}), Z = /* @__PURE__ */ u({
|
|
138
138
|
__name: "LinkToolbarAction",
|
|
139
139
|
props: { editor: {} },
|
|
140
140
|
setup(e) {
|
|
141
|
-
let t = e, { t: n } =
|
|
142
|
-
|
|
143
|
-
text: ""
|
|
144
|
-
});
|
|
145
|
-
w(o, (e) => {
|
|
141
|
+
let t = e, { t: n } = I(), i = h(!1), a = h({ href: "" });
|
|
142
|
+
C(i, (e) => {
|
|
146
143
|
if (!e) {
|
|
147
|
-
|
|
148
|
-
href: "",
|
|
149
|
-
text: ""
|
|
150
|
-
};
|
|
144
|
+
a.value = { href: "" };
|
|
151
145
|
return;
|
|
152
146
|
}
|
|
153
147
|
let n = t.editor?.getAttributes("link").href, r = n && typeof n == "string" ? n : void 0;
|
|
154
|
-
if (r && (
|
|
148
|
+
if (r && (a.value.href = r), t.editor) {
|
|
155
149
|
let { from: e, to: n, empty: r } = t.editor.state.selection, i = r ? "" : t.editor.state.doc.textBetween(e, n);
|
|
156
|
-
|
|
150
|
+
a.value.label = i;
|
|
157
151
|
}
|
|
158
152
|
}, { immediate: !0 });
|
|
159
|
-
let
|
|
160
|
-
let
|
|
161
|
-
if (!
|
|
153
|
+
let o = (e) => {
|
|
154
|
+
let n = e?.href.trim(), r = e?.label?.trim() || n;
|
|
155
|
+
if (!n) return s();
|
|
162
156
|
t.editor?.chain().focus().extendMarkRange("link").insertContent([{
|
|
163
157
|
type: "text",
|
|
164
|
-
text:
|
|
158
|
+
text: r,
|
|
165
159
|
marks: [{
|
|
166
160
|
type: "link",
|
|
167
|
-
attrs: { href:
|
|
161
|
+
attrs: { href: n }
|
|
168
162
|
}]
|
|
169
|
-
}]).run(), t.editor?.chain().setTextSelection(t.editor.state.selection.to).unsetMark("link").run(),
|
|
170
|
-
},
|
|
171
|
-
t.editor?.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
163
|
+
}]).run(), t.editor?.chain().setTextSelection(t.editor.state.selection.to).unsetMark("link").run(), i.value = !1;
|
|
164
|
+
}, s = () => {
|
|
165
|
+
t.editor?.chain().focus().extendMarkRange("link").unsetLink().run(), i.value = !1;
|
|
172
166
|
};
|
|
173
|
-
return (e,
|
|
174
|
-
open:
|
|
175
|
-
"onUpdate:open":
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
density: "compact"
|
|
167
|
+
return (e, s) => (m(), r(b(N), {
|
|
168
|
+
open: i.value,
|
|
169
|
+
"onUpdate:open": s[0] ||= (e) => i.value = e,
|
|
170
|
+
"model-value": a.value,
|
|
171
|
+
"onUpdate:modelValue": o
|
|
179
172
|
}, {
|
|
180
|
-
trigger:
|
|
173
|
+
trigger: w(({ trigger: e }) => [l(J, f(e, {
|
|
181
174
|
label: b(n)("editor.link.edit"),
|
|
182
|
-
icon: b(
|
|
175
|
+
icon: b(me),
|
|
183
176
|
active: t.editor?.isActive("link"),
|
|
184
177
|
disabled: !t.editor?.can().chain().toggleLink().run()
|
|
185
178
|
}), null, 16, [
|
|
@@ -188,71 +181,30 @@ var K = (e) => ({
|
|
|
188
181
|
"active",
|
|
189
182
|
"disabled"
|
|
190
183
|
])]),
|
|
191
|
-
footer: T(() => [l(b(A), { density: "compact" }, {
|
|
192
|
-
default: T(() => [l(b(j), {
|
|
193
|
-
label: b(n)("cancel"),
|
|
194
|
-
color: "neutral",
|
|
195
|
-
mode: "outline",
|
|
196
|
-
onClick: u[2] ||= (e) => o.value = !1
|
|
197
|
-
}, null, 8, ["label"]), l(b(j), {
|
|
198
|
-
label: b(n)("apply"),
|
|
199
|
-
icon: b(he),
|
|
200
|
-
form: b(a),
|
|
201
|
-
type: "submit"
|
|
202
|
-
}, null, 8, [
|
|
203
|
-
"label",
|
|
204
|
-
"icon",
|
|
205
|
-
"form"
|
|
206
|
-
])]),
|
|
207
|
-
_: 1
|
|
208
|
-
})]),
|
|
209
|
-
default: T(() => [o.value ? (m(), r(b(P), {
|
|
210
|
-
key: 0,
|
|
211
|
-
id: b(a),
|
|
212
|
-
class: "onyx-editor-link-action__content",
|
|
213
|
-
onSubmit: E(c, ["prevent"])
|
|
214
|
-
}, {
|
|
215
|
-
default: T(() => [l(b(I), {
|
|
216
|
-
modelValue: s.value.text,
|
|
217
|
-
"onUpdate:modelValue": u[0] ||= (e) => s.value.text = e,
|
|
218
|
-
label: b(n)("editor.link.text"),
|
|
219
|
-
required: ""
|
|
220
|
-
}, null, 8, ["modelValue", "label"]), l(b(I), {
|
|
221
|
-
modelValue: s.value.href,
|
|
222
|
-
"onUpdate:modelValue": u[1] ||= (e) => s.value.href = e,
|
|
223
|
-
label: b(n)("editor.link.link"),
|
|
224
|
-
type: "url",
|
|
225
|
-
autofocus: ""
|
|
226
|
-
}, {
|
|
227
|
-
leadingIcons: T(() => [l(b(F), { icon: b(W) }, null, 8, ["icon"])]),
|
|
228
|
-
_: 1
|
|
229
|
-
}, 8, ["modelValue", "label"])]),
|
|
230
|
-
_: 1
|
|
231
|
-
}, 8, ["id"])) : i("", !0)]),
|
|
232
184
|
_: 1
|
|
233
|
-
}, 8, ["open", "
|
|
185
|
+
}, 8, ["open", "model-value"]));
|
|
234
186
|
}
|
|
235
|
-
}),
|
|
187
|
+
}), Ae = /* @__PURE__ */ u({
|
|
236
188
|
__name: "ListToolbarAction",
|
|
237
189
|
props: { editor: {} },
|
|
238
190
|
setup(e) {
|
|
239
|
-
let t = e, { t: i } =
|
|
191
|
+
let t = e, { t: i } = I(), { hasExtension: a } = K(y(t, "editor")), o = n(() => {
|
|
240
192
|
let e = [];
|
|
241
193
|
return a.value("bulletList") && e.push({
|
|
242
194
|
label: i.value("editor.lists.unorderedList"),
|
|
243
|
-
icon:
|
|
195
|
+
icon: U,
|
|
244
196
|
active: t.editor?.isActive("bulletList"),
|
|
245
197
|
onClick: () => t.editor?.chain().focus().toggleBulletList().run()
|
|
246
198
|
}), a.value("orderedList") && e.push({
|
|
247
199
|
label: i.value("editor.lists.orderedList"),
|
|
248
|
-
icon:
|
|
200
|
+
icon: ge,
|
|
249
201
|
active: t.editor?.isActive("orderedList"),
|
|
250
202
|
onClick: () => t.editor?.chain().focus().toggleOrderedList().run()
|
|
251
203
|
}), e;
|
|
252
204
|
});
|
|
253
205
|
return (e, t) => (m(), r(X, {
|
|
254
206
|
label: b(i)("editor.lists.lists"),
|
|
255
|
-
icon: b(
|
|
207
|
+
icon: b(he),
|
|
256
208
|
options: o.value
|
|
257
209
|
}, null, 8, [
|
|
258
210
|
"label",
|
|
@@ -260,31 +212,31 @@ var K = (e) => ({
|
|
|
260
212
|
"options"
|
|
261
213
|
]));
|
|
262
214
|
}
|
|
263
|
-
}),
|
|
215
|
+
}), je = { class: "onyx-text-editor__toolbar" }, Me = { class: "onyx-text-editor__actions" }, Ne = {
|
|
264
216
|
key: 0,
|
|
265
217
|
class: "onyx-text-editor__actions onyx-text-editor__actions--fixed"
|
|
266
|
-
},
|
|
218
|
+
}, Pe = /* @__PURE__ */ u({
|
|
267
219
|
__name: "EditorToolbar",
|
|
268
220
|
props: { editor: {} },
|
|
269
221
|
setup(e) {
|
|
270
|
-
let t = e, s =
|
|
271
|
-
return (t, n) => (m(), a("div",
|
|
222
|
+
let t = e, s = x(), { t: c } = I(), { hasExtension: u, hasTextExtension: d } = K(n(() => t.editor));
|
|
223
|
+
return (t, n) => (m(), a("div", je, [o("div", Me, [
|
|
272
224
|
l(Y, null, {
|
|
273
|
-
default:
|
|
225
|
+
default: w(() => [b(u)("heading") ? (m(), r(ke, {
|
|
274
226
|
key: 0,
|
|
275
227
|
editor: e.editor
|
|
276
|
-
}, null, 8, ["editor"])) : i("", !0), b(u)("bulletList") || b(u)("orderedList") ? (m(), r(
|
|
228
|
+
}, null, 8, ["editor"])) : i("", !0), b(u)("bulletList") || b(u)("orderedList") ? (m(), r(Ae, {
|
|
277
229
|
key: 1,
|
|
278
230
|
editor: e.editor
|
|
279
231
|
}, null, 8, ["editor"])) : i("", !0)]),
|
|
280
232
|
_: 1
|
|
281
233
|
}),
|
|
282
234
|
l(Y, null, {
|
|
283
|
-
default:
|
|
235
|
+
default: w(() => [
|
|
284
236
|
b(u)("bold") ? (m(), r(J, {
|
|
285
237
|
key: 0,
|
|
286
238
|
label: b(c)("editor.bold"),
|
|
287
|
-
icon: b(
|
|
239
|
+
icon: b(ye),
|
|
288
240
|
active: e.editor?.isActive("bold"),
|
|
289
241
|
disabled: !e.editor?.can().chain().toggleBold().run(),
|
|
290
242
|
onClick: n[0] ||= (t) => e.editor?.chain().focus().toggleBold().run()
|
|
@@ -297,7 +249,7 @@ var K = (e) => ({
|
|
|
297
249
|
b(u)("italic") ? (m(), r(J, {
|
|
298
250
|
key: 1,
|
|
299
251
|
label: b(c)("editor.italic"),
|
|
300
|
-
icon: b(
|
|
252
|
+
icon: b(be),
|
|
301
253
|
active: e.editor?.isActive("italic"),
|
|
302
254
|
disabled: !e.editor?.can().chain().toggleItalic().run(),
|
|
303
255
|
onClick: n[1] ||= (t) => e.editor?.chain().focus().toggleItalic().run()
|
|
@@ -310,7 +262,7 @@ var K = (e) => ({
|
|
|
310
262
|
b(u)("underline") ? (m(), r(J, {
|
|
311
263
|
key: 2,
|
|
312
264
|
label: b(c)("editor.underline"),
|
|
313
|
-
icon: b(
|
|
265
|
+
icon: b(Se),
|
|
314
266
|
active: e.editor?.isActive("underline"),
|
|
315
267
|
disabled: !e.editor?.can().chain().toggleUnderline().run(),
|
|
316
268
|
onClick: n[2] ||= (t) => e.editor?.chain().focus().toggleUnderline().run()
|
|
@@ -323,7 +275,7 @@ var K = (e) => ({
|
|
|
323
275
|
b(u)("strike") ? (m(), r(J, {
|
|
324
276
|
key: 3,
|
|
325
277
|
label: b(c)("editor.strike"),
|
|
326
|
-
icon: b(
|
|
278
|
+
icon: b(xe),
|
|
327
279
|
active: e.editor?.isActive("strike"),
|
|
328
280
|
disabled: !e.editor?.can().chain().toggleStrike().run(),
|
|
329
281
|
onClick: n[3] ||= (t) => e.editor?.chain().focus().toggleStrike().run()
|
|
@@ -337,11 +289,11 @@ var K = (e) => ({
|
|
|
337
289
|
_: 1
|
|
338
290
|
}),
|
|
339
291
|
l(Y, null, {
|
|
340
|
-
default:
|
|
292
|
+
default: w(() => [
|
|
341
293
|
b(d)("left") ? (m(), r(J, {
|
|
342
294
|
key: 0,
|
|
343
295
|
label: b(c)("editor.alignments.left"),
|
|
344
|
-
icon: b(
|
|
296
|
+
icon: b(H),
|
|
345
297
|
active: e.editor?.isActive({ textAlign: "left" }),
|
|
346
298
|
disabled: !e.editor?.can().chain().toggleTextAlign("left").run(),
|
|
347
299
|
onClick: n[4] ||= (t) => e.editor?.chain().focus().toggleTextAlign("left").run()
|
|
@@ -354,7 +306,7 @@ var K = (e) => ({
|
|
|
354
306
|
b(d)("center") ? (m(), r(J, {
|
|
355
307
|
key: 1,
|
|
356
308
|
label: b(c)("editor.alignments.center"),
|
|
357
|
-
icon: b(
|
|
309
|
+
icon: b(V),
|
|
358
310
|
active: e.editor?.isActive({ textAlign: "center" }),
|
|
359
311
|
disabled: !e.editor?.can().chain().toggleTextAlign("center").run(),
|
|
360
312
|
onClick: n[5] ||= (t) => e.editor?.chain().focus().toggleTextAlign("center").run()
|
|
@@ -367,7 +319,7 @@ var K = (e) => ({
|
|
|
367
319
|
b(d)("right") ? (m(), r(J, {
|
|
368
320
|
key: 2,
|
|
369
321
|
label: b(c)("editor.alignments.right"),
|
|
370
|
-
icon: b(
|
|
322
|
+
icon: b(le),
|
|
371
323
|
active: e.editor?.isActive({ textAlign: "right" }),
|
|
372
324
|
disabled: !e.editor?.can().chain().toggleTextAlign("right").run(),
|
|
373
325
|
onClick: n[6] ||= (t) => e.editor?.chain().focus().toggleTextAlign("right").run()
|
|
@@ -380,7 +332,7 @@ var K = (e) => ({
|
|
|
380
332
|
b(d)("justify") ? (m(), r(J, {
|
|
381
333
|
key: 3,
|
|
382
334
|
label: b(c)("editor.alignments.block"),
|
|
383
|
-
icon: b(
|
|
335
|
+
icon: b(B),
|
|
384
336
|
active: e.editor?.isActive({ textAlign: "justify" }),
|
|
385
337
|
disabled: !e.editor?.can().chain().toggleTextAlign("justify").run(),
|
|
386
338
|
onClick: n[7] ||= (t) => e.editor?.chain().focus().toggleTextAlign("justify").run()
|
|
@@ -394,13 +346,13 @@ var K = (e) => ({
|
|
|
394
346
|
_: 1
|
|
395
347
|
}),
|
|
396
348
|
l(Y, null, {
|
|
397
|
-
default:
|
|
349
|
+
default: w(() => [b(u)("link") ? (m(), r(Z, {
|
|
398
350
|
key: 0,
|
|
399
351
|
editor: e.editor
|
|
400
352
|
}, null, 8, ["editor"])) : i("", !0), b(u)("blockquote") ? (m(), r(J, {
|
|
401
353
|
key: 1,
|
|
402
354
|
label: b(c)("editor.blockquote"),
|
|
403
|
-
icon: b(
|
|
355
|
+
icon: b(_e),
|
|
404
356
|
active: e.editor?.isActive("blockquote"),
|
|
405
357
|
disabled: !e.editor?.can().chain().toggleBlockquote().run(),
|
|
406
358
|
onClick: n[8] ||= (t) => e.editor?.chain().focus().toggleBlockquote().run()
|
|
@@ -413,12 +365,12 @@ var K = (e) => ({
|
|
|
413
365
|
_: 1
|
|
414
366
|
}),
|
|
415
367
|
s.default ? (m(), r(Y, { key: 0 }, {
|
|
416
|
-
default:
|
|
368
|
+
default: w(() => [_(t.$slots, "default")]),
|
|
417
369
|
_: 3
|
|
418
370
|
})) : i("", !0)
|
|
419
|
-
]), b(u)("undoRedo") ? (m(), a("div",
|
|
371
|
+
]), b(u)("undoRedo") ? (m(), a("div", Ne, [l(J, {
|
|
420
372
|
label: b(c)("editor.undo"),
|
|
421
|
-
icon: b(
|
|
373
|
+
icon: b(Ce),
|
|
422
374
|
disabled: !e.editor?.can().chain().undo().run(),
|
|
423
375
|
onClick: n[9] ||= (t) => e.editor?.chain().focus().undo().run()
|
|
424
376
|
}, null, 8, [
|
|
@@ -427,7 +379,7 @@ var K = (e) => ({
|
|
|
427
379
|
"disabled"
|
|
428
380
|
]), l(J, {
|
|
429
381
|
label: b(c)("editor.redo"),
|
|
430
|
-
icon: b(
|
|
382
|
+
icon: b(ve),
|
|
431
383
|
disabled: !e.editor?.can().chain().redo().run(),
|
|
432
384
|
onClick: n[10] ||= (t) => e.editor?.chain().focus().redo().run()
|
|
433
385
|
}, null, 8, [
|
|
@@ -436,14 +388,14 @@ var K = (e) => ({
|
|
|
436
388
|
"disabled"
|
|
437
389
|
])])) : i("", !0)]));
|
|
438
390
|
}
|
|
439
|
-
}), Q =
|
|
391
|
+
}), Q = De.extend({ renderHTML({ node: e, HTMLAttributes: t }) {
|
|
440
392
|
let n = e.attrs.level;
|
|
441
393
|
return [
|
|
442
394
|
`h${n}`,
|
|
443
|
-
|
|
395
|
+
E(this.options.HTMLAttributes, t, { class: ["onyx-headline", `onyx-headline--h${n}`].join(" ") }),
|
|
444
396
|
0
|
|
445
397
|
];
|
|
446
|
-
} }), $ =
|
|
398
|
+
} }), $ = T.create({
|
|
447
399
|
name: "onyxStarterKit",
|
|
448
400
|
addOptions() {
|
|
449
401
|
return {
|
|
@@ -464,20 +416,20 @@ var K = (e) => ({
|
|
|
464
416
|
};
|
|
465
417
|
},
|
|
466
418
|
addExtensions() {
|
|
467
|
-
let e = [
|
|
419
|
+
let e = [Ee.configure({
|
|
468
420
|
...this.options,
|
|
469
421
|
heading: !1
|
|
470
|
-
}),
|
|
471
|
-
return this.options.heading !== !1 && e.push(Q.configure(this.options.heading)), this.options.textAlign !== !1 && e.push(
|
|
422
|
+
}), Te];
|
|
423
|
+
return this.options.heading !== !1 && e.push(Q.configure(this.options.heading)), this.options.textAlign !== !1 && e.push(we.configure(this.options.textAlign)), e;
|
|
472
424
|
}
|
|
473
|
-
}),
|
|
425
|
+
}), Fe = /* @__PURE__ */ u({
|
|
474
426
|
__name: "OnyxTextEditor",
|
|
475
427
|
props: {
|
|
476
428
|
density: {},
|
|
477
|
-
requiredMarker: { default:
|
|
429
|
+
requiredMarker: { default: D },
|
|
478
430
|
reserveMessageSpace: {
|
|
479
431
|
type: [Boolean, Symbol],
|
|
480
|
-
default:
|
|
432
|
+
default: D
|
|
481
433
|
},
|
|
482
434
|
showError: {
|
|
483
435
|
type: [
|
|
@@ -485,7 +437,7 @@ var K = (e) => ({
|
|
|
485
437
|
String,
|
|
486
438
|
Symbol
|
|
487
439
|
],
|
|
488
|
-
default:
|
|
440
|
+
default: D
|
|
489
441
|
},
|
|
490
442
|
label: {},
|
|
491
443
|
skeleton: {
|
|
@@ -494,7 +446,7 @@ var K = (e) => ({
|
|
|
494
446
|
Boolean,
|
|
495
447
|
Number
|
|
496
448
|
],
|
|
497
|
-
default:
|
|
449
|
+
default: F
|
|
498
450
|
},
|
|
499
451
|
message: {},
|
|
500
452
|
error: {},
|
|
@@ -503,7 +455,7 @@ var K = (e) => ({
|
|
|
503
455
|
loading: { type: Boolean },
|
|
504
456
|
disabled: {
|
|
505
457
|
type: [Boolean, Symbol],
|
|
506
|
-
default:
|
|
458
|
+
default: D
|
|
507
459
|
},
|
|
508
460
|
autofocus: { type: Boolean },
|
|
509
461
|
placeholder: {},
|
|
@@ -518,15 +470,15 @@ var K = (e) => ({
|
|
|
518
470
|
},
|
|
519
471
|
emits: ["update:modelValue"],
|
|
520
472
|
setup(e, { expose: a, emit: c }) {
|
|
521
|
-
let u = e, d = c, { t: g } =
|
|
473
|
+
let u = e, d = c, { t: g } = I(), y = oe(u), x = n(() => y.disabled.value || u.loading);
|
|
522
474
|
ee(q, { disabled: x });
|
|
523
|
-
let
|
|
475
|
+
let T = se({
|
|
524
476
|
props: u,
|
|
525
477
|
emit: d,
|
|
526
478
|
key: "modelValue",
|
|
527
479
|
default: "<p></p>"
|
|
528
|
-
}),
|
|
529
|
-
content:
|
|
480
|
+
}), D = ie({
|
|
481
|
+
content: T.value,
|
|
530
482
|
extensions: [...u.extensions, ne.configure({
|
|
531
483
|
showOnlyWhenEditable: !1,
|
|
532
484
|
placeholder: () => u.placeholder ?? ""
|
|
@@ -536,37 +488,44 @@ var K = (e) => ({
|
|
|
536
488
|
role: "textbox"
|
|
537
489
|
} },
|
|
538
490
|
onUpdate: () => {
|
|
539
|
-
if (!
|
|
540
|
-
let e =
|
|
541
|
-
e !==
|
|
491
|
+
if (!D.value) return;
|
|
492
|
+
let e = D.value.getHTML();
|
|
493
|
+
e !== T.value && (T.value = e);
|
|
542
494
|
}
|
|
495
|
+
}), O = n(() => D.value?.getText()), { whitespaceError: k } = ce({
|
|
496
|
+
modelValue: O,
|
|
497
|
+
props: u
|
|
543
498
|
});
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}),
|
|
547
|
-
u.autofocus &&
|
|
548
|
-
}, { immediate: !0 }),
|
|
549
|
-
|
|
499
|
+
C([T, D], ([e]) => {
|
|
500
|
+
D.value && e !== D.value.getHTML() && D.value.commands.setContent(e);
|
|
501
|
+
}), C([() => u.autofocus, D], () => {
|
|
502
|
+
u.autofocus && D.value?.commands.focus();
|
|
503
|
+
}, { immediate: !0 }), C([x, D], () => {
|
|
504
|
+
D.value?.setEditable(!x.value);
|
|
550
505
|
}, { immediate: !0 });
|
|
551
|
-
let
|
|
506
|
+
let A = n(() => D.value?.storage.characterCount.characters() ?? 0), j = n(() => {
|
|
552
507
|
if (!u.withCounter || !u.maxlength) return;
|
|
553
|
-
let e =
|
|
508
|
+
let e = A.value, t = u.maxlength;
|
|
554
509
|
return {
|
|
555
510
|
length: e,
|
|
556
511
|
maxlength: t,
|
|
557
512
|
violated: e > t
|
|
558
513
|
};
|
|
559
|
-
}),
|
|
560
|
-
|
|
561
|
-
let
|
|
514
|
+
}), M = h(!1);
|
|
515
|
+
C(T, () => M.value = !0, { once: !0 });
|
|
516
|
+
let N = n(() => {
|
|
562
517
|
if (u.error) return u.error;
|
|
563
|
-
if (u.required &&
|
|
518
|
+
if (u.required && D.value?.isEmpty) return {
|
|
564
519
|
label: g.value("validations.valueMissing.preview"),
|
|
565
520
|
tooltipText: g.value("validations.valueMissing.fullError")
|
|
566
521
|
};
|
|
567
|
-
if (
|
|
522
|
+
if (k.value) return {
|
|
523
|
+
label: k.value.shortMessage,
|
|
524
|
+
tooltipText: k.value.longMessage
|
|
525
|
+
};
|
|
526
|
+
if (u.minlength && A.value < u.minlength) {
|
|
568
527
|
let e = {
|
|
569
|
-
n:
|
|
528
|
+
n: A.value,
|
|
570
529
|
minLength: u.minlength
|
|
571
530
|
};
|
|
572
531
|
return {
|
|
@@ -574,9 +533,9 @@ var K = (e) => ({
|
|
|
574
533
|
tooltipText: g.value("validations.tooShort.fullError", e)
|
|
575
534
|
};
|
|
576
535
|
}
|
|
577
|
-
if (u.maxlength &&
|
|
536
|
+
if (u.maxlength && A.value > u.maxlength) {
|
|
578
537
|
let e = {
|
|
579
|
-
n:
|
|
538
|
+
n: A.value,
|
|
580
539
|
maxLength: u.maxlength
|
|
581
540
|
};
|
|
582
541
|
return {
|
|
@@ -585,73 +544,73 @@ var K = (e) => ({
|
|
|
585
544
|
};
|
|
586
545
|
}
|
|
587
546
|
});
|
|
588
|
-
|
|
547
|
+
C([
|
|
589
548
|
() => u.label,
|
|
590
549
|
() => u.disableManualResize,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
550
|
+
D,
|
|
551
|
+
M,
|
|
552
|
+
N
|
|
594
553
|
], () => {
|
|
595
|
-
let e =
|
|
596
|
-
|
|
554
|
+
let e = D.value?.options.editorProps.attributes;
|
|
555
|
+
D.value?.setOptions({ editorProps: { attributes: (t) => {
|
|
597
556
|
let n = typeof e == "function" ? e(t) : e ?? {}, r = [];
|
|
598
|
-
return u.disableManualResize && r.push("onyx-text-editor__input--no-resize"),
|
|
557
|
+
return u.disableManualResize && r.push("onyx-text-editor__input--no-resize"), M.value && r.push("onyx-form-element-v2__input--touched"), E(n, {
|
|
599
558
|
"aria-label": u.label,
|
|
600
559
|
class: r,
|
|
601
|
-
"aria-invalid":
|
|
560
|
+
"aria-invalid": N.value ? "true" : "false"
|
|
602
561
|
});
|
|
603
562
|
} } });
|
|
604
|
-
}, { immediate: !0 }),
|
|
605
|
-
|
|
563
|
+
}, { immediate: !0 }), C(() => u.placeholder, () => {
|
|
564
|
+
D.value?.view.dispatch(D.value.state.tr);
|
|
606
565
|
});
|
|
607
|
-
let
|
|
566
|
+
let F = R(u, P), L = n(() => {
|
|
608
567
|
if (u.autosize) return {
|
|
609
568
|
"--onyx-text-editor-autosize-min-rows": u.autosize.min ? Math.max(u.autosize.min, 2) : void 0,
|
|
610
569
|
"--onyx-text-editor-autosize-max-rows": u.autosize.max ?? "unset"
|
|
611
570
|
};
|
|
612
|
-
}),
|
|
571
|
+
}), z = n(() => D.value?.getText({ blockSeparator: "\n" })), B = S("formElement"), V = n(() => (B.value?.$el)?.querySelector(".onyx-form-element-v2__content")), H = S("nativeInput");
|
|
613
572
|
return te(() => {
|
|
614
|
-
if (!
|
|
615
|
-
|
|
573
|
+
if (!N.value) {
|
|
574
|
+
H.value?.setCustomValidity("");
|
|
616
575
|
return;
|
|
617
576
|
}
|
|
618
|
-
let e = typeof
|
|
619
|
-
|
|
620
|
-
}), a({ editor:
|
|
577
|
+
let e = typeof N.value == "string" ? N.value : `${N.value.label} ${N.value.tooltipText ?? ""}`.trim();
|
|
578
|
+
H.value?.setCustomValidity(e);
|
|
579
|
+
}), a({ editor: D }), (e, n) => (m(), r(b(P), f(b(F), {
|
|
621
580
|
ref_key: "formElement",
|
|
622
|
-
ref:
|
|
623
|
-
error:
|
|
581
|
+
ref: B,
|
|
582
|
+
error: N.value,
|
|
624
583
|
class: ["onyx-text-editor", { "onyx-text-editor--toolbar-bottom": u.toolbar?.position === "bottom" }],
|
|
625
|
-
style:
|
|
584
|
+
style: L.value
|
|
626
585
|
}), s({
|
|
627
|
-
default:
|
|
628
|
-
|
|
586
|
+
default: w(() => [
|
|
587
|
+
V.value ? (m(), r(t, {
|
|
629
588
|
key: 0,
|
|
630
|
-
to:
|
|
631
|
-
}, [l(
|
|
632
|
-
default:
|
|
589
|
+
to: V.value
|
|
590
|
+
}, [l(Pe, { editor: b(D) }, {
|
|
591
|
+
default: w(() => [_(e.$slots, "actions")]),
|
|
633
592
|
_: 3
|
|
634
593
|
}, 8, ["editor"])], 8, ["to"])) : i("", !0),
|
|
635
594
|
l(b(re), {
|
|
636
595
|
class: "onyx-text-editor__wrapper",
|
|
637
|
-
"data-autosize-value":
|
|
638
|
-
editor: b(
|
|
596
|
+
"data-autosize-value": z.value,
|
|
597
|
+
editor: b(D)
|
|
639
598
|
}, null, 8, ["data-autosize-value", "editor"]),
|
|
640
|
-
l(b(
|
|
641
|
-
default:
|
|
599
|
+
l(b(ae), { "aria-hidden": "true" }, {
|
|
600
|
+
default: w(() => [o("input", {
|
|
642
601
|
ref_key: "nativeInput",
|
|
643
|
-
ref:
|
|
602
|
+
ref: H,
|
|
644
603
|
tabindex: "-1",
|
|
645
|
-
onInvalid: n[0] ||= (e) =>
|
|
646
|
-
onFocus: n[1] ||= (e) => b(
|
|
604
|
+
onInvalid: n[0] ||= (e) => M.value = !0,
|
|
605
|
+
onFocus: n[1] ||= (e) => b(D)?.commands.focus()
|
|
647
606
|
}, null, 544)]),
|
|
648
607
|
_: 1
|
|
649
608
|
})
|
|
650
609
|
]),
|
|
651
610
|
_: 2
|
|
652
|
-
}, [
|
|
611
|
+
}, [j.value ? {
|
|
653
612
|
name: "bottomRight",
|
|
654
|
-
fn:
|
|
613
|
+
fn: w(() => [o("span", { class: p(["onyx-text-editor__counter", { "onyx-text-editor__counter--violated": j.value.violated }]) }, v(j.value.length) + "/" + v(j.value.maxlength), 3)]),
|
|
655
614
|
key: "0"
|
|
656
615
|
} : void 0]), 1040, [
|
|
657
616
|
"error",
|
|
@@ -661,4 +620,4 @@ var K = (e) => ({
|
|
|
661
620
|
}
|
|
662
621
|
});
|
|
663
622
|
//#endregion
|
|
664
|
-
export { J as OnyxEditorToolbarAction, X as OnyxEditorToolbarFlyout, Y as OnyxEditorToolbarGroup, Q as OnyxHeadingExtension, $ as OnyxStarterKit,
|
|
623
|
+
export { J as OnyxEditorToolbarAction, X as OnyxEditorToolbarFlyout, Y as OnyxEditorToolbarGroup, Q as OnyxHeadingExtension, $ as OnyxStarterKit, Fe as OnyxTextEditor, q as TEXT_EDITOR_INJECTION_KEY, K as useEditorUtils };
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@layer onyx.component{.onyx-editor-toolbar-action{display:flex}.onyx-editor-toolbar-action .onyx-system-button:disabled{pointer-events:none}.onyx-editor-toolbar-group{display:contents}.onyx-editor-toolbar-group:after{content:"";background-color:var(--onyx-color-component-border-neutral);height:1lh;width:var(--onyx-1px-in-rem);flex-shrink:0}.onyx-editor-toolbar-group:empty,.onyx-editor-toolbar-group:last-of-type:after{display:none}.onyx-editor-toolbar-group:has(+.onyx-editor-toolbar-group:empty):after{display:none}.onyx-
|
|
1
|
+
@layer onyx.component{.onyx-editor-toolbar-action{display:flex}.onyx-editor-toolbar-action .onyx-system-button:disabled{pointer-events:none}.onyx-editor-toolbar-group{display:contents}.onyx-editor-toolbar-group:after{content:"";background-color:var(--onyx-color-component-border-neutral);height:1lh;width:var(--onyx-1px-in-rem);flex-shrink:0}.onyx-editor-toolbar-group:empty,.onyx-editor-toolbar-group:last-of-type:after{display:none}.onyx-editor-toolbar-group:has(+.onyx-editor-toolbar-group:empty):after{display:none}.onyx-text-editor__toolbar{border:var(--onyx-form-element-v2-border-size) solid var(--onyx-form-element-v2-border-color);border-radius:inherit;color:var(--onyx-color-text-icons-neutral-medium);background-color:var(--onyx-color-base-background-tinted);border-top-left-radius:var(--onyx-text-editor-input-border-radius-bottom);border-top-right-radius:var(--onyx-text-editor-input-border-radius-bottom);border-bottom-left-radius:var(--onyx-text-editor-input-border-radius-top);border-bottom-right-radius:var(--onyx-text-editor-input-border-radius-top);justify-content:space-between;align-items:center;width:100%;max-width:100%;display:flex}.onyx-text-editor:not(.onyx-text-editor--toolbar-bottom) .onyx-text-editor__toolbar{border-bottom:none}.onyx-text-editor--toolbar-bottom .onyx-text-editor__toolbar{border-top:none}.onyx-text-editor__actions{align-items:center;gap:var(--onyx-density-xs);padding:var(--onyx-form-element-v2-padding-block) var(--onyx-form-element-v2-padding-inline);display:flex;overflow:auto}.onyx-text-editor__actions--fixed{overflow:visible}.onyx-text-editor{--onyx-text-editor-autosize-min-rows:3;--onyx-text-editor-autosize-max-rows:10;--onyx-text-editor-min-height:calc(var(--onyx-text-editor-autosize-min-rows) * 1lh + 2 * var(--onyx-form-element-v2-padding-block));--onyx-text-editor-max-height:calc(var(--onyx-text-editor-autosize-max-rows) * 1lh + 2 * var(--onyx-form-element-v2-padding-block));--onyx-form-element-v2-content-height:calc(1lh * var(--onyx-text-editor-autosize-min-rows))}.onyx-text-editor:has(.onyx-text-editor__input[style*=height]){--onyx-text-editor-max-height:unset}.onyx-text-editor:has(.onyx-text-editor__input[style*=height]) .onyx-text-editor__wrapper:after{height:0}.onyx-text-editor__counter--violated{color:var(--onyx-color-text-icons-danger-intense)}.onyx-text-editor{--onyx-text-editor-flex-direction:column-reverse;--onyx-text-editor-input-border-radius-top:0;--onyx-text-editor-input-border-radius-bottom:var(--onyx-form-element-v2-border-radius);--onyx-form-element-v2-border-color-focus:var(--onyx-form-element-v2-border-color);--onyx-form-element-v2-outline-color:transparent;max-width:100%}.onyx-text-editor--toolbar-bottom{--onyx-text-editor-flex-direction:column;--onyx-text-editor-input-border-radius-top:var(--onyx-form-element-v2-border-radius);--onyx-text-editor-input-border-radius-bottom:0}.onyx-text-editor__wrapper{width:100%;height:100%;padding:0;display:grid}.onyx-text-editor__wrapper:after{content:attr(data-autosize-value) " ";white-space:pre-wrap;visibility:hidden;overflow-wrap:anywhere;overflow-y:hidden}.onyx-text-editor>.onyx-form-element-v2__body>.onyx-form-element-v2__content{height:unset;flex-direction:var(--onyx-text-editor-flex-direction)}.onyx-text-editor>.onyx-form-element-v2__body>.onyx-form-element-v2__content>.onyx-form-element-v2__input-container{border-top-left-radius:var(--onyx-text-editor-input-border-radius-top);border-top-right-radius:var(--onyx-text-editor-input-border-radius-top);border-bottom-left-radius:var(--onyx-text-editor-input-border-radius-bottom);border-bottom-right-radius:var(--onyx-text-editor-input-border-radius-bottom);align-items:flex-start;width:100%}.onyx-text-editor>.onyx-form-element-v2__body>.onyx-form-element-v2__content>.onyx-form-element-v2__input-container:focus-within{z-index:0}.onyx-text-editor__wrapper:after,.onyx-text-editor__input{height:100%;min-height:var(--onyx-text-editor-min-height);max-height:var(--onyx-text-editor-max-height);padding:var(--onyx-form-element-v2-padding-block) var(--onyx-form-element-v2-padding-inline);word-break:break-word;grid-area:1/1}.onyx-text-editor__input blockquote{border-left:var(--onyx-spacing-5xs) solid var(--onyx-color-component-border-neutral);padding-left:var(--onyx-density-xs);color:var(--onyx-color-text-icons-neutral-medium)}.onyx-text-editor__input p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;pointer-events:none;height:0;color:var(--onyx-color-text-icons-neutral-soft);font-weight:var(--onyx-font-weight-regular)}.onyx-text-editor__input{resize:vertical;overflow-y:auto;overflow-x:unset;white-space:pre-line}.onyx-text-editor__input--no-resize{resize:none}}@layer onyx.override{.onyx-editor-toolbar-action .onyx-system-button.active{--color:var(--onyx-color-text-icons-primary-intense);--hover-background-color:var(--onyx-color-base-primary-200);--focus-active-background-color:var(--onyx-color-base-primary-200)}.onyx-editor-toolbar-flyout__chevron{--icon-size:.75rem}.onyx-editor-toolbar-flyout__icon{color:var(--onyx-color-text-icons-neutral-medium)}}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { DefineComponent } from 'vue';
|
|
2
2
|
/**
|
|
3
|
-
* Utility for creating a Storybook example/story where the example uses a dedicated .vue file
|
|
4
|
-
* The example must be put inside e.g.
|
|
3
|
+
* Utility for creating a Storybook example/story where the example uses a dedicated .vue file
|
|
4
|
+
* (useful for advanced examples). The example must be put inside e.g.
|
|
5
|
+
* "src/components/{componentName}/examples/{exampleName}".
|
|
5
6
|
*
|
|
6
|
-
* Make sure to import all onyx components, types etc. from the index file "../../../" so its
|
|
7
|
+
* Make sure to import all onyx components, types etc. from the index file "../../../" so its
|
|
8
|
+
* replaced correctly in the code snippet.
|
|
7
9
|
*
|
|
8
|
-
* **Note** The "Controls" and "Actions" panel/tab will be disabled for this story since they will
|
|
10
|
+
* **Note** The "Controls" and "Actions" panel/tab will be disabled for this story since they will
|
|
11
|
+
* probably be mostly unusable due to the custom example.
|
|
9
12
|
*/
|
|
10
13
|
export declare function createAdvancedStoryExample(componentName: string, exampleName: string): {
|
|
11
14
|
render: (args: {}) => {
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/tiptap",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.1-dev-20260826081244",
|
|
4
|
+
"description": "A rich text editor powered by the Tiptap editor and the onyx design system created by Schwarz Digits",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/SchwarzIT/onyx/issues"
|
|
7
|
+
},
|
|
7
8
|
"license": "Apache-2.0",
|
|
8
|
-
"
|
|
9
|
-
|
|
9
|
+
"author": "Schwarz Digits IT KG",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/SchwarzIT/onyx",
|
|
13
|
+
"directory": "packages/tiptap"
|
|
10
14
|
},
|
|
11
15
|
"files": [
|
|
12
16
|
"dist"
|
|
13
17
|
],
|
|
18
|
+
"type": "module",
|
|
14
19
|
"module": "./dist/index.js",
|
|
15
20
|
"types": "./dist/index.d.ts",
|
|
16
21
|
"exports": {
|
|
@@ -22,44 +27,39 @@
|
|
|
22
27
|
"./style.css": "./dist/style.css",
|
|
23
28
|
"./component-meta.json": "./dist/component-meta.json"
|
|
24
29
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@axe-core/playwright": "^4.13.0",
|
|
32
|
+
"@playwright/experimental-ct-vue": "1.62.1",
|
|
33
|
+
"@playwright/test": "1.62.1",
|
|
34
|
+
"@sit-onyx/icons": "^1.12.0",
|
|
35
|
+
"@sit-onyx/playwright-utils": "^1.3.0",
|
|
36
|
+
"@sit-onyx/shared": "^0.1.0",
|
|
37
|
+
"@sit-onyx/storybook-utils": "^1.1.4",
|
|
38
|
+
"@sit-onyx/vite-plugin-component-meta": "^0.0.0",
|
|
39
|
+
"@tiptap/extension-heading": "^3.30.2",
|
|
40
|
+
"@tiptap/extension-text-align": "^3.30.2",
|
|
41
|
+
"@tiptap/extensions": "^3.30.2",
|
|
42
|
+
"@tiptap/pm": "^3.30.2",
|
|
43
|
+
"@tiptap/starter-kit": "^3.30.2",
|
|
44
|
+
"@tiptap/vue-3": "^3.30.2",
|
|
45
|
+
"@vue/compiler-dom": "3.5.41",
|
|
46
|
+
"sit-onyx": "^1.20.0-dev-20260826081244",
|
|
47
|
+
"unplugin-dts": "1.0.3",
|
|
48
|
+
"vite": "8.2.2"
|
|
32
49
|
},
|
|
33
50
|
"peerDependencies": {
|
|
51
|
+
"@sit-onyx/icons": "^1.12.0",
|
|
34
52
|
"@tiptap/extension-heading": ">= 3",
|
|
35
53
|
"@tiptap/extension-text-align": ">= 3",
|
|
36
54
|
"@tiptap/extensions": ">= 3",
|
|
37
55
|
"@tiptap/pm": ">= 3",
|
|
38
56
|
"@tiptap/starter-kit": ">= 3",
|
|
39
57
|
"@tiptap/vue-3": ">= 3",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"sit-onyx": "^1.14.0"
|
|
58
|
+
"sit-onyx": "^1.20.0-dev-20260826081244",
|
|
59
|
+
"vue": ">= 3.5.0"
|
|
43
60
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"@playwright/experimental-ct-vue": "1.60.0",
|
|
47
|
-
"@playwright/test": "1.60.0",
|
|
48
|
-
"@tiptap/extension-heading": "^3.24.0",
|
|
49
|
-
"@tiptap/extension-text-align": "^3.24.0",
|
|
50
|
-
"@tiptap/extensions": "^3.24.0",
|
|
51
|
-
"@tiptap/pm": "^3.24.0",
|
|
52
|
-
"@tiptap/starter-kit": "^3.24.0",
|
|
53
|
-
"@tiptap/vue-3": "^3.24.0",
|
|
54
|
-
"@vue/compiler-dom": "3.5.35",
|
|
55
|
-
"unplugin-dts": "1.0.1",
|
|
56
|
-
"vite": "8.0.14",
|
|
57
|
-
"@sit-onyx/icons": "^1.10.0",
|
|
58
|
-
"@sit-onyx/playwright-utils": "^1.3.0",
|
|
59
|
-
"@sit-onyx/shared": "^0.1.0",
|
|
60
|
-
"@sit-onyx/storybook-utils": "^1.1.3",
|
|
61
|
-
"@sit-onyx/vite-plugin-component-meta": "^0.0.0",
|
|
62
|
-
"sit-onyx": "^1.14.0"
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=20"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"dev": "storybook dev -p 6006 --no-open",
|