@projectfive/v-richtext-vue2 0.0.0-stage → 3.0.0

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.
Files changed (106) hide show
  1. package/Readme.md +69 -0
  2. package/dist/style.css +1 -0
  3. package/dist/types/richtext-vue/src/components/input-richtext/CharacterCount.vue.d.ts +19 -0
  4. package/dist/types/richtext-vue/src/components/input-richtext/InputRichtext.vue.d.ts +135 -0
  5. package/dist/types/richtext-vue/src/components/input-richtext/MediaControls.vue.d.ts +3 -0
  6. package/dist/types/richtext-vue/src/components/input-richtext/MentionMenu.vue.d.ts +21 -0
  7. package/dist/types/richtext-vue/src/components/input-richtext/TableMenu.vue.d.ts +19 -0
  8. package/dist/types/richtext-vue/src/components/input-richtext/TableOfContents.vue.d.ts +3 -0
  9. package/dist/types/richtext-vue/src/components/input-richtext/TemplatesMenu.vue.d.ts +18 -0
  10. package/dist/types/richtext-vue/src/components/input-richtext/UploadPopover.vue.d.ts +24 -0
  11. package/dist/types/richtext-vue/src/components/input-richtext/VisibilityConditionsMenu.vue.d.ts +20 -0
  12. package/dist/types/richtext-vue/src/components/input-richtext/YoutubePopover.vue.d.ts +4 -0
  13. package/dist/types/richtext-vue/src/components/input-richtext/extensions/file-drop.d.ts +22 -0
  14. package/dist/types/richtext-vue/src/components/input-richtext/extensions/file-node.d.ts +18 -0
  15. package/dist/types/richtext-vue/src/components/input-richtext/extensions/heading-id.d.ts +14 -0
  16. package/dist/types/richtext-vue/src/components/input-richtext/extensions/index.d.ts +36 -0
  17. package/dist/types/richtext-vue/src/components/input-richtext/extensions/link.d.ts +8 -0
  18. package/dist/types/richtext-vue/src/components/input-richtext/extensions/media-attributes.d.ts +8 -0
  19. package/dist/types/richtext-vue/src/components/input-richtext/extensions/mention-menu.d.ts +62 -0
  20. package/dist/types/richtext-vue/src/components/input-richtext/extensions/mention.d.ts +16 -0
  21. package/dist/types/richtext-vue/src/components/input-richtext/extensions/previews.d.ts +8 -0
  22. package/dist/types/richtext-vue/src/components/input-richtext/extensions/task-item.d.ts +8 -0
  23. package/dist/types/richtext-vue/src/components/input-richtext/extensions/visibility-conditions.d.ts +32 -0
  24. package/dist/types/richtext-vue/src/components/input-richtext/liquid.d.ts +11 -0
  25. package/dist/types/richtext-vue/src/components/input-richtext/types.d.ts +122 -0
  26. package/dist/types/richtext-vue/src/components/tiptap-icons/Icon.vue.d.ts +15 -0
  27. package/dist/types/richtext-vue/src/components/tiptap-icons/index.d.ts +40 -0
  28. package/dist/types/richtext-vue/src/components/tiptap-ui/CommandButton.vue.d.ts +36 -0
  29. package/dist/types/richtext-vue/src/components/tiptap-ui/blockquote-button/index.d.ts +1 -0
  30. package/dist/types/richtext-vue/src/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +12 -0
  31. package/dist/types/richtext-vue/src/components/tiptap-ui/code-block-button/index.d.ts +1 -0
  32. package/dist/types/richtext-vue/src/components/tiptap-ui/code-block-button/use-code-block.d.ts +12 -0
  33. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-button/index.d.ts +1 -0
  34. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +125 -0
  35. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-popover/ColorHighlightPopover.vue.d.ts +3 -0
  36. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-popover/ColorHighlightPopoverButton.vue.d.ts +17 -0
  37. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-popover/ColorHighlightPopoverContent.vue.d.ts +183 -0
  38. package/dist/types/richtext-vue/src/components/tiptap-ui/color-highlight-popover/index.d.ts +3 -0
  39. package/dist/types/richtext-vue/src/components/tiptap-ui/command.d.ts +26 -0
  40. package/dist/types/richtext-vue/src/components/tiptap-ui/heading-button/index.d.ts +1 -0
  41. package/dist/types/richtext-vue/src/components/tiptap-ui/heading-button/use-heading.d.ts +25 -0
  42. package/dist/types/richtext-vue/src/components/tiptap-ui/heading-dropdown-menu/HeadingDropdownMenu.vue.d.ts +32 -0
  43. package/dist/types/richtext-vue/src/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  44. package/dist/types/richtext-vue/src/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +6 -0
  45. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/LinkButton.vue.d.ts +17 -0
  46. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/LinkContent.vue.d.ts +18 -0
  47. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/LinkMain.vue.d.ts +28 -0
  48. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/LinkPopover.vue.d.ts +62 -0
  49. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/index.d.ts +4 -0
  50. package/dist/types/richtext-vue/src/components/tiptap-ui/link-popover/use-link-popover.d.ts +96 -0
  51. package/dist/types/richtext-vue/src/components/tiptap-ui/list-button/index.d.ts +1 -0
  52. package/dist/types/richtext-vue/src/components/tiptap-ui/list-button/use-list.d.ts +22 -0
  53. package/dist/types/richtext-vue/src/components/tiptap-ui/list-dropdown-menu/ListDropdownMenu.vue.d.ts +32 -0
  54. package/dist/types/richtext-vue/src/components/tiptap-ui/list-dropdown-menu/index.d.ts +2 -0
  55. package/dist/types/richtext-vue/src/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +15 -0
  56. package/dist/types/richtext-vue/src/components/tiptap-ui/mark-button/index.d.ts +1 -0
  57. package/dist/types/richtext-vue/src/components/tiptap-ui/mark-button/use-mark.d.ts +29 -0
  58. package/dist/types/richtext-vue/src/components/tiptap-ui/text-align-button/index.d.ts +1 -0
  59. package/dist/types/richtext-vue/src/components/tiptap-ui/text-align-button/use-text-align.d.ts +27 -0
  60. package/dist/types/richtext-vue/src/components/tiptap-ui/undo-redo-button/index.d.ts +1 -0
  61. package/dist/types/richtext-vue/src/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +17 -0
  62. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/button/Button.vue.d.ts +53 -0
  63. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  64. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/button-group/ButtonGroup.vue.d.ts +43 -0
  65. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
  66. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/card/Card.vue.d.ts +16 -0
  67. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/card/CardBody.vue.d.ts +15 -0
  68. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/card/CardItemGroup.vue.d.ts +42 -0
  69. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/card/index.d.ts +3 -0
  70. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/dropdown-menu/DropdownMenu.vue.d.ts +66 -0
  71. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  72. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/input/Input.vue.d.ts +20 -0
  73. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  74. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/popover/Popover.vue.d.ts +65 -0
  75. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  76. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/separator/Separator.vue.d.ts +35 -0
  77. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  78. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/spacer/Spacer.vue.d.ts +31 -0
  79. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  80. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/toolbar/Toolbar.vue.d.ts +45 -0
  81. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/toolbar/ToolbarGroup.vue.d.ts +15 -0
  82. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/toolbar/ToolbarSeparator.vue.d.ts +3 -0
  83. package/dist/types/richtext-vue/src/components/tiptap-ui-primitive/toolbar/index.d.ts +3 -0
  84. package/dist/types/richtext-vue/src/composables/use-editor-state.d.ts +32 -0
  85. package/dist/types/richtext-vue/src/composables/use-is-breakpoint.d.ts +10 -0
  86. package/dist/types/richtext-vue/src/composables/use-menu-navigation.d.ts +55 -0
  87. package/dist/types/richtext-vue/src/composables/use-popover.d.ts +45 -0
  88. package/dist/types/richtext-vue/src/composables/use-tiptap-editor.d.ts +16 -0
  89. package/dist/types/richtext-vue/src/composables/use-top-layer.d.ts +9 -0
  90. package/dist/types/richtext-vue/src/composables/use-translations.d.ts +7 -0
  91. package/dist/types/richtext-vue/src/composables/utils.d.ts +21 -0
  92. package/dist/types/richtext-vue/src/index.d.ts +14 -0
  93. package/dist/types/richtext-vue/src/lib/pointer.d.ts +6 -0
  94. package/dist/types/richtext-vue/src/lib/resize-image.d.ts +6 -0
  95. package/dist/types/richtext-vue/src/lib/shortcuts.d.ts +24 -0
  96. package/dist/types/richtext-vue/src/lib/throttle.d.ts +10 -0
  97. package/dist/types/richtext-vue/src/lib/tiptap-utils.d.ts +109 -0
  98. package/dist/types/richtext-vue/src/locales/en.d.ts +140 -0
  99. package/dist/types/richtext-vue/src/locales/index.d.ts +5 -0
  100. package/dist/types/richtext-vue/src/locales/nl.d.ts +2 -0
  101. package/dist/types/richtext-vue2/src/components/tiptap-ui-primitive/portal/Portal.vue.d.ts +15 -0
  102. package/dist/types/richtext-vue2/src/lib/tiptap-vue.d.ts +9 -0
  103. package/dist/v-richtext.js +3318 -0
  104. package/dist/v-richtext.js.map +1 -0
  105. package/package.json +64 -6
  106. package/README.md +0 -3
@@ -0,0 +1,62 @@
1
+ import type { SuggestionKeyDownProps, SuggestionProps } from "@tiptap/suggestion";
2
+ import type { MentionNodeAttrs } from "@tiptap/extension-mention";
3
+ import type { MentionSuggestion } from "../types";
4
+ export interface MentionItem {
5
+ id: string | number;
6
+ /** Name without the "Group:" prefix; listed and stored as the mention's label */
7
+ label: string;
8
+ /** Heading the item is listed under */
9
+ group?: string;
10
+ suggestion: MentionSuggestion;
11
+ }
12
+ export interface MentionMenuState {
13
+ open: boolean;
14
+ items: MentionItem[];
15
+ selectedIndex: number;
16
+ /** Position of the typed "@query", for placing the menu */
17
+ rect: DOMRect | null;
18
+ }
19
+ export type MentionMenu = ReturnType<typeof createMentionMenu>;
20
+ /**
21
+ * State for the mention suggestion list, shared by all trigger characters of one
22
+ * editor (only one suggestion can be active at a time). The suggestion plugin
23
+ * drives it through `render`, and MentionMenu.vue renders it.
24
+ */
25
+ export declare function createMentionMenu(): {
26
+ state: {
27
+ open: boolean;
28
+ items: {
29
+ id: string | number;
30
+ label: string;
31
+ group?: string | undefined;
32
+ suggestion: {
33
+ [x: string]: unknown;
34
+ id: string | number;
35
+ name: string;
36
+ apply?: boolean | undefined;
37
+ hooks?: unknown[] | undefined;
38
+ };
39
+ }[];
40
+ selectedIndex: number;
41
+ rect: {
42
+ height: number;
43
+ width: number;
44
+ x: number;
45
+ y: number;
46
+ readonly bottom: number;
47
+ readonly left: number;
48
+ readonly right: number;
49
+ readonly top: number;
50
+ toJSON: () => any;
51
+ } | null;
52
+ };
53
+ select: (index?: number) => void;
54
+ render: () => {
55
+ onBeforeStart?: ((props: SuggestionProps<MentionItem, MentionNodeAttrs>) => void) | undefined;
56
+ onStart?: ((props: SuggestionProps<MentionItem, MentionNodeAttrs>) => void) | undefined;
57
+ onBeforeUpdate?: ((props: SuggestionProps<MentionItem, MentionNodeAttrs>) => void) | undefined;
58
+ onUpdate?: ((props: SuggestionProps<MentionItem, MentionNodeAttrs>) => void) | undefined;
59
+ onExit?: ((props: SuggestionProps<MentionItem, MentionNodeAttrs>) => void) | undefined;
60
+ onKeyDown?: (props: SuggestionKeyDownProps) => boolean;
61
+ };
62
+ };
@@ -0,0 +1,16 @@
1
+ import type { MentionMenu } from "./mention-menu";
2
+ import type { MentionGroupOptions, RichtextAction } from "../types";
3
+ export interface MentionContext {
4
+ groups: Record<string, MentionGroupOptions>;
5
+ menu: MentionMenu;
6
+ getPreviews: () => Record<string, unknown>;
7
+ onAction: (action: RichtextAction) => void;
8
+ }
9
+ /**
10
+ * Mentions with one trigger character per group in `options.mentions`
11
+ * (e.g. "@" for assignees and "#" for labels).
12
+ *
13
+ * Renders as `<span class="mention mention-<group> <class>" data-type="mention"
14
+ * data-id data-label data-mention-suggestion-char>`, readable by v-richtext 2.x.
15
+ */
16
+ export declare function createMention({ groups, menu, getPreviews, onAction }: MentionContext): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
@@ -0,0 +1,8 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ /**
3
+ * Transaction meta that makes the decorations based on `mentionPreviews`
4
+ * (mention values, hidden visibility conditions) read the previews again.
5
+ */
6
+ export declare const PREVIEWS_CHANGED = "rt-previews-changed";
7
+ /** Call after the preview values changed */
8
+ export declare function refreshPreviews(editor: Editor): void;
@@ -0,0 +1,8 @@
1
+ import type { RichtextMessages } from "@/locales";
2
+ /**
3
+ * Tiptap's task item, whose checkbox can also be toggled while the editor is
4
+ * read-only (`readonly="tasks"`). Tiptap's `onReadOnlyChecked` only keeps the
5
+ * checkbox checked and gets the node as it was when the view was created, so
6
+ * the change is written to the document here, which emits the new value.
7
+ */
8
+ export declare function createTaskItem(canCheckReadonly: () => boolean, messages: () => RichtextMessages): import("@tiptap/core").Node<import("@tiptap/extension-list").TaskItemOptions, any>;
@@ -0,0 +1,32 @@
1
+ import { Node } from "@tiptap/core";
2
+ import { type RichtextMessages } from "@/locales";
3
+ import type { VisibilityCondition } from "../types";
4
+ declare module "@tiptap/core" {
5
+ interface Commands<ReturnType> {
6
+ visibilityConditions: {
7
+ /**
8
+ * Wraps the selected blocks in the condition. Removes the wrapper when the
9
+ * selection is already in that condition, or switches to it when the
10
+ * selection is in another condition.
11
+ */
12
+ toggleCondition: (condition: VisibilityCondition) => ReturnType;
13
+ /** Removes the condition wrapper around the selection */
14
+ unsetCondition: () => ReturnType;
15
+ };
16
+ }
17
+ }
18
+ export declare const VISIBILITY_CONDITION_NODE = "visibilityConditions";
19
+ export interface VisibilityConditionsOptions {
20
+ /** `mentionPreviews`, which can hold the outcome of a condition, keyed by its `if` */
21
+ getPreviews: () => Record<string, unknown>;
22
+ messages: () => RichtextMessages;
23
+ }
24
+ /**
25
+ * Block that is only shown when a condition is met, like a blockquote wraps
26
+ * other blocks. Stored as
27
+ * `<div class="conditionally-visible" condition="…" condition-label="…">`.
28
+ *
29
+ * The HTML output wraps it in liquid tags, see ../liquid.ts.
30
+ * The node name matches v-richtext 2.x, so JSON content stays compatible.
31
+ */
32
+ export declare const VisibilityConditions: Node<VisibilityConditionsOptions, any>;
@@ -0,0 +1,11 @@
1
+ export declare const liquidIf: (condition: string) => string;
2
+ export declare const LIQUID_ENDIF = "{% endif %}";
3
+ /**
4
+ * Wraps every visibility condition block in `{% if <condition> %}` … `{% endif %}`.
5
+ */
6
+ export declare function addLiquidConditions(html: string): string;
7
+ /**
8
+ * Removes the liquid wrappers that `addLiquidConditions` put around visibility
9
+ * condition blocks, so the HTML can be loaded into the editor again.
10
+ */
11
+ export declare function stripLiquidConditions(html: string): string;
@@ -0,0 +1,122 @@
1
+ import type { Content } from "@tiptap/core";
2
+ export type RichtextValue = Content;
3
+ /**
4
+ * Extensions that can be switched on or off with `options.enabled` / `options.disabled`.
5
+ * `mention` and `visibilityConditions` switch on by themselves when their options are set.
6
+ */
7
+ export type RichtextExtensionName = "bold" | "italic" | "strike" | "underline" | "code" | "highlight" | "subscript" | "superscript" | "link" | "heading" | "bulletList" | "orderedList" | "taskList" | "blockquote" | "codeBlock" | "horizontalRule" | "textAlign" | "image" | "file" | "youtube" | "table" | "placeholder" | "typography"
8
+ /** Size/float/caption toolbar on a selected image or YouTube video */
9
+ | "mediaControls"
10
+ /** Lines in the top right corner, one per heading, that list and link to the headings on hover */
11
+ | "tableOfContents"
12
+ /** Undo/redo buttons. Ctrl+Z / Ctrl+Shift+Z always work. */
13
+ | "undoRedo" | "characterCount" | "templates" | "mention" | "visibilityConditions";
14
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
15
+ export interface MentionSuggestion {
16
+ id: string | number;
17
+ /** Shown in the suggestion list. "Group: Name" puts the item under a "Group" heading. */
18
+ name: string;
19
+ /** When false, choosing the item only fires the `action` event, nothing is inserted */
20
+ apply?: boolean;
21
+ /** Passed along in the `action` event, together with the group's hooks */
22
+ hooks?: unknown[];
23
+ [key: string]: unknown;
24
+ }
25
+ export interface MentionGroupOptions {
26
+ /** Character that opens the suggestions, e.g. "@" or "#" */
27
+ key: string;
28
+ /** Show the key in front of the mention. Default: true */
29
+ keyInMention?: boolean;
30
+ /** Extra class(es) on the mention element */
31
+ class?: string;
32
+ /** When false, no suggestion of this group is inserted. Default: true */
33
+ apply?: boolean;
34
+ hooks?: unknown[];
35
+ suggestions: MentionSuggestion[];
36
+ }
37
+ export interface CharacterCountOptions {
38
+ /** Shows a hint while there are fewer characters. Doesn't block input. */
39
+ min?: number;
40
+ /** Maximum number of characters; typing stops there */
41
+ limit?: number;
42
+ }
43
+ export interface RichtextTemplate {
44
+ /** Shown in the dropdown */
45
+ name: string;
46
+ /**
47
+ * HTML, e.g. with mention spans (`<span data-type="mention" data-id="{{ data.name }}"
48
+ * data-label="Name">`), which become mentions with their previews. Plain text is
49
+ * inserted as one paragraph per line.
50
+ */
51
+ text: string;
52
+ }
53
+ export interface VisibilityCondition {
54
+ /** Liquid expression, e.g. "data.approved" */
55
+ if: string;
56
+ label: string;
57
+ }
58
+ export interface RichtextOptions {
59
+ /** Extensions to switch on in addition to the defaults */
60
+ enabled?: (RichtextExtensionName | string)[];
61
+ /** Extensions to switch off. Wins over `enabled`. */
62
+ disabled?: (RichtextExtensionName | string)[];
63
+ /**
64
+ * Extensions that stay enabled but get no toolbar button; they're used
65
+ * through their keyboard shortcut and Markdown-style input (e.g. `code`).
66
+ * See HIDEABLE_BUTTONS for the ones that can be hidden.
67
+ */
68
+ hidden?: (RichtextExtensionName | string)[];
69
+ heading?: {
70
+ /** Default: [2, 3] */
71
+ levels?: HeadingLevel[];
72
+ };
73
+ /**
74
+ * Shows the character count under the editor. Also enabled by adding
75
+ * "characterCount" to `enabled`, which shows the count without min/limit.
76
+ */
77
+ characterCount?: CharacterCountOptions;
78
+ image?: {
79
+ /**
80
+ * Wider images (JPEG, PNG, WebP) are scaled down to this width before they're
81
+ * uploaded. Default: 1200. 0 uploads them unchanged.
82
+ */
83
+ maxWidth?: number;
84
+ };
85
+ table?: {
86
+ /** Size of a new table. Default: 3 × 3 with a header row */
87
+ insertDefaults?: {
88
+ rows: number;
89
+ cols: number;
90
+ withHeaderRow: boolean;
91
+ };
92
+ };
93
+ /** Predefined texts, inserted from a toolbar dropdown. Enables the dropdown when it has entries. */
94
+ templates?: RichtextTemplate[];
95
+ /** One entry per trigger character. Enables mentions when it has entries. */
96
+ mentions?: Record<string, MentionGroupOptions>;
97
+ /** Enables the visibility conditions menu when it has conditions */
98
+ visibilityConditions?: {
99
+ conditions: VisibilityCondition[];
100
+ };
101
+ }
102
+ export type UploadFileFunction = (file: File, type: "file" | "image") => Promise<string>;
103
+ export interface SelectMentionAction {
104
+ action: "select_mention";
105
+ /** Key of the mention group in `options.mentions` */
106
+ name: string;
107
+ options: MentionGroupOptions;
108
+ suggestion: MentionSuggestion;
109
+ hooks: unknown[];
110
+ }
111
+ export type RichtextAction = SelectMentionAction;
112
+ /** Emitted as `error`, e.g. when an upload fails or a file is too large */
113
+ export interface RichtextUploadError {
114
+ type: "upload";
115
+ file: File;
116
+ message: string;
117
+ error: Error;
118
+ }
119
+ export type RichtextError = RichtextUploadError;
120
+ export type RichtextToolbarPosition = "top" | "bottom";
121
+ /** Language of the editor's own texts (buttons, tooltips, messages) */
122
+ export type RichtextLocale = "nl" | "en";
@@ -0,0 +1,15 @@
1
+ import type { IconName } from "@/components/tiptap-icons";
2
+ type __VLS_Props = {
3
+ name: IconName;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ type __VLS_TypePropsToOption<T> = {
9
+ [K in keyof T & string]-?: {} extends Pick<T, K> ? {
10
+ type: import('vue').PropType<Required<T>[K]>;
11
+ } : {
12
+ type: import('vue').PropType<T[K]>;
13
+ required: true;
14
+ };
15
+ };
@@ -0,0 +1,40 @@
1
+ export declare const AlignCenterIcon: "align-center";
2
+ export declare const AlignJustifyIcon: "align-justify";
3
+ export declare const AlignLeftIcon: "align-left";
4
+ export declare const AlignRightIcon: "align-right";
5
+ export declare const ArrowLeftIcon: "arrow-left";
6
+ export declare const BanIcon: "ban";
7
+ export declare const BlockquoteIcon: "blockquote";
8
+ export declare const BoldIcon: "bold";
9
+ export declare const ChevronDownIcon: "chevron-down";
10
+ export declare const CodeBlockIcon: "code-block";
11
+ export declare const Code2Icon: "code2";
12
+ export declare const CornerDownLeftIcon: "corner-down-left";
13
+ export declare const ExternalLinkIcon: "external-link";
14
+ export declare const HeadingFiveIcon: "heading-five";
15
+ export declare const HeadingFourIcon: "heading-four";
16
+ export declare const HeadingIcon: "heading";
17
+ export declare const HeadingOneIcon: "heading-one";
18
+ export declare const HeadingSixIcon: "heading-six";
19
+ export declare const HeadingThreeIcon: "heading-three";
20
+ export declare const HeadingTwoIcon: "heading-two";
21
+ export declare const HighlighterIcon: "highlighter";
22
+ export declare const ImagePlusIcon: "image-plus";
23
+ export declare const ItalicIcon: "italic";
24
+ export declare const LinkIcon: "link";
25
+ export declare const ListIcon: "list";
26
+ export declare const ListOrderedIcon: "list-ordered";
27
+ export declare const ListTodoIcon: "list-todo";
28
+ export declare const Redo2Icon: "redo2";
29
+ export declare const StrikeIcon: "strike";
30
+ export declare const SubscriptIcon: "subscript";
31
+ export declare const SuperscriptIcon: "superscript";
32
+ export declare const TrashIcon: "trash";
33
+ export declare const UnderlineIcon: "underline";
34
+ export declare const Undo2Icon: "undo2";
35
+ export declare const EyeIcon: "eye";
36
+ export declare const PaperclipIcon: "paperclip";
37
+ export declare const YoutubeIcon: "youtube";
38
+ export declare const TableIcon: "table";
39
+ export declare const FileTextIcon: "file-text";
40
+ export type IconName = "align-center" | "align-justify" | "align-left" | "align-right" | "arrow-left" | "ban" | "blockquote" | "bold" | "chevron-down" | "code-block" | "code2" | "corner-down-left" | "eye" | "external-link" | "heading-five" | "heading-four" | "heading" | "heading-one" | "heading-six" | "heading-three" | "heading-two" | "highlighter" | "image-plus" | "italic" | "link" | "list" | "list-ordered" | "list-todo" | "redo2" | "strike" | "subscript" | "superscript" | "trash" | "underline" | "undo2" | "paperclip" | "youtube" | "table" | "file-text";
@@ -0,0 +1,36 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ import type { EditorCommand } from "./command";
3
+ /**
4
+ * p5: one toolbar button for any EditorCommand, e.g.
5
+ * `<CommandButton :command="markCommand('bold')" />`. Replaces the template's
6
+ * MarkButton, HeadingButton, ListButton, … (see UPSTREAM.md).
7
+ */
8
+ type __VLS_Props = {
9
+ command: EditorCommand;
10
+ /** Text next to the icon, e.g. in dropdown menus */
11
+ text?: string;
12
+ editor?: Editor | null;
13
+ };
14
+ declare const __VLS_template: () => {
15
+ __VLS_Slots: {
16
+ default?: (props: {}) => any;
17
+ };
18
+ };
19
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
21
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
24
+ type __VLS_TypePropsToOption<T> = {
25
+ [K in keyof T & string]-?: {} extends Pick<T, K> ? {
26
+ type: import('vue').PropType<Required<T>[K]>;
27
+ } : {
28
+ type: import('vue').PropType<T[K]>;
29
+ required: true;
30
+ };
31
+ };
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -0,0 +1 @@
1
+ export * from "./use-blockquote";
@@ -0,0 +1,12 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ export declare const BLOCKQUOTE_SHORTCUT_KEY = "mod+shift+b";
3
+ /**
4
+ * Checks if blockquote can be toggled in the current editor state
5
+ */
6
+ export declare function canToggleBlockquote(editor: Editor | null, turnInto?: boolean): boolean;
7
+ /**
8
+ * Toggles blockquote formatting for a specific node or the current selection
9
+ */
10
+ export declare function toggleBlockquote(editor: Editor | null): boolean;
11
+ /** p5: toolbar command, rendered by CommandButton (see ../command.ts) */
12
+ export declare const blockquoteCommand: () => import("@/components/tiptap-ui/command").EditorCommand;
@@ -0,0 +1 @@
1
+ export * from "./use-code-block";
@@ -0,0 +1,12 @@
1
+ import { type Editor } from "@tiptap/core";
2
+ export declare const CODE_BLOCK_SHORTCUT_KEY = "mod+alt+c";
3
+ /**
4
+ * Checks if code block can be toggled in the current editor state
5
+ */
6
+ export declare function canToggle(editor: Editor | null, turnInto?: boolean): boolean;
7
+ /**
8
+ * Toggles code block in the editor
9
+ */
10
+ export declare function toggleCodeBlock(editor: Editor | null): boolean;
11
+ /** p5: toolbar command, rendered by CommandButton (see ../command.ts) */
12
+ export declare const codeBlockCommand: () => import("@/components/tiptap-ui/command").EditorCommand;
@@ -0,0 +1 @@
1
+ export * from "./use-color-highlight";
@@ -0,0 +1,125 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ export declare const COLOR_HIGHLIGHT_SHORTCUT_KEY = "mod+shift+h";
3
+ export declare const HIGHLIGHT_COLORS: readonly [{
4
+ readonly name: "default";
5
+ readonly value: "var(--tt-bg-color)";
6
+ readonly colorValue: "#ffffff";
7
+ readonly border: "var(--tt-bg-color-contrast)";
8
+ }, {
9
+ readonly name: "gray";
10
+ readonly value: "var(--tt-color-highlight-gray)";
11
+ readonly colorValue: "#f8f8f7";
12
+ readonly border: "var(--tt-color-highlight-gray-contrast)";
13
+ }, {
14
+ readonly name: "brown";
15
+ readonly value: "var(--tt-color-highlight-brown)";
16
+ readonly colorValue: "#f4eeee";
17
+ readonly border: "var(--tt-color-highlight-brown-contrast)";
18
+ }, {
19
+ readonly name: "orange";
20
+ readonly value: "var(--tt-color-highlight-orange)";
21
+ readonly colorValue: "#fbecdd";
22
+ readonly border: "var(--tt-color-highlight-orange-contrast)";
23
+ }, {
24
+ readonly name: "yellow";
25
+ readonly value: "var(--tt-color-highlight-yellow)";
26
+ readonly colorValue: "#fef9c3";
27
+ readonly border: "var(--tt-color-highlight-yellow-contrast)";
28
+ }, {
29
+ readonly name: "green";
30
+ readonly value: "var(--tt-color-highlight-green)";
31
+ readonly colorValue: "#dcfce7";
32
+ readonly border: "var(--tt-color-highlight-green-contrast)";
33
+ }, {
34
+ readonly name: "blue";
35
+ readonly value: "var(--tt-color-highlight-blue)";
36
+ readonly colorValue: "#e0f2fe";
37
+ readonly border: "var(--tt-color-highlight-blue-contrast)";
38
+ }, {
39
+ readonly name: "purple";
40
+ readonly value: "var(--tt-color-highlight-purple)";
41
+ readonly colorValue: "#f3e8ff";
42
+ readonly border: "var(--tt-color-highlight-purple-contrast)";
43
+ }, {
44
+ readonly name: "pink";
45
+ readonly value: "var(--tt-color-highlight-pink)";
46
+ readonly colorValue: "#fcf1f6";
47
+ readonly border: "var(--tt-color-highlight-pink-contrast)";
48
+ }, {
49
+ readonly name: "red";
50
+ readonly value: "var(--tt-color-highlight-red)";
51
+ readonly colorValue: "#ffe4e6";
52
+ readonly border: "var(--tt-color-highlight-red-contrast)";
53
+ }];
54
+ export type HighlightColor = (typeof HIGHLIGHT_COLORS)[number];
55
+ export declare function pickHighlightColorsByValue(values: string[]): ({
56
+ readonly name: "default";
57
+ readonly value: "var(--tt-bg-color)";
58
+ readonly colorValue: "#ffffff";
59
+ readonly border: "var(--tt-bg-color-contrast)";
60
+ } | {
61
+ readonly name: "gray";
62
+ readonly value: "var(--tt-color-highlight-gray)";
63
+ readonly colorValue: "#f8f8f7";
64
+ readonly border: "var(--tt-color-highlight-gray-contrast)";
65
+ } | {
66
+ readonly name: "brown";
67
+ readonly value: "var(--tt-color-highlight-brown)";
68
+ readonly colorValue: "#f4eeee";
69
+ readonly border: "var(--tt-color-highlight-brown-contrast)";
70
+ } | {
71
+ readonly name: "orange";
72
+ readonly value: "var(--tt-color-highlight-orange)";
73
+ readonly colorValue: "#fbecdd";
74
+ readonly border: "var(--tt-color-highlight-orange-contrast)";
75
+ } | {
76
+ readonly name: "yellow";
77
+ readonly value: "var(--tt-color-highlight-yellow)";
78
+ readonly colorValue: "#fef9c3";
79
+ readonly border: "var(--tt-color-highlight-yellow-contrast)";
80
+ } | {
81
+ readonly name: "green";
82
+ readonly value: "var(--tt-color-highlight-green)";
83
+ readonly colorValue: "#dcfce7";
84
+ readonly border: "var(--tt-color-highlight-green-contrast)";
85
+ } | {
86
+ readonly name: "blue";
87
+ readonly value: "var(--tt-color-highlight-blue)";
88
+ readonly colorValue: "#e0f2fe";
89
+ readonly border: "var(--tt-color-highlight-blue-contrast)";
90
+ } | {
91
+ readonly name: "purple";
92
+ readonly value: "var(--tt-color-highlight-purple)";
93
+ readonly colorValue: "#f3e8ff";
94
+ readonly border: "var(--tt-color-highlight-purple-contrast)";
95
+ } | {
96
+ readonly name: "pink";
97
+ readonly value: "var(--tt-color-highlight-pink)";
98
+ readonly colorValue: "#fcf1f6";
99
+ readonly border: "var(--tt-color-highlight-pink-contrast)";
100
+ } | {
101
+ readonly name: "red";
102
+ readonly value: "var(--tt-color-highlight-red)";
103
+ readonly colorValue: "#ffe4e6";
104
+ readonly border: "var(--tt-color-highlight-red-contrast)";
105
+ })[];
106
+ /**
107
+ * Checks if a highlight can be applied in the current editor state
108
+ * p5: only the highlight mark; the template's "node background" mode is removed
109
+ */
110
+ export declare function canColorHighlight(editor: Editor | null): boolean;
111
+ /**
112
+ * Checks if a highlight (optionally of a specific color) is active
113
+ */
114
+ export declare function isColorHighlightActive(editor: Editor | null, highlightColor?: string): boolean;
115
+ /**
116
+ * Applies a highlight color, or removes it when the selection already has it
117
+ */
118
+ export declare function toggleColorHighlight(editor: Editor | null, color: string): boolean;
119
+ /**
120
+ * Removes the highlight from the selection
121
+ */
122
+ export declare function removeHighlight(editor: Editor | null): boolean;
123
+ /** p5: toolbar command per color, rendered by CommandButton (see ../command.ts) */
124
+ export declare const highlightCommand: (color: HighlightColor) => import("@/components/tiptap-ui/command").EditorCommand;
125
+ export declare const removeHighlightCommand: () => import("@/components/tiptap-ui/command").EditorCommand;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, unknown, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ declare const __VLS_template: () => {
2
+ __VLS_Slots: {
3
+ default?: (props: {}) => any;
4
+ };
5
+ };
6
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
7
+ declare const __VLS_base: import("vue").DefineComponent<{}, unknown, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ click: (event: MouseEvent) => void;
9
+ }, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };