frappe-ui 1.1.0 → 1.2.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 (103) hide show
  1. package/experimental/Calendar/CalendarEventRow.vue +0 -4
  2. package/experimental/CommandPalette/CommandPaletteItem.vue +9 -1
  3. package/experimental/SpriteIcons/IconPicker.vue +2 -1
  4. package/experimental.ts +0 -21
  5. package/package.json +1 -3
  6. package/src/components/Breadcrumbs/Breadcrumbs.vue +2 -1
  7. package/src/components/DatePicker/DatePicker.md +7 -0
  8. package/src/components/DatePicker/DatePicker.vue +6 -0
  9. package/src/components/DatePicker/DateTimePicker.vue +6 -0
  10. package/src/components/DatePicker/composables.ts +18 -1
  11. package/src/components/DatePicker/utils.ts +53 -0
  12. package/src/components/HoverCard/HoverCard.vue +21 -5
  13. package/src/components/MobileNav/MobileNavItem.vue +3 -22
  14. package/src/components/SettingsDialog/SettingsDialog.api.md +7 -2
  15. package/src/components/SettingsDialog/SettingsDialog.md +2 -1
  16. package/src/components/SettingsDialog/SettingsRow.vue +12 -2
  17. package/src/components/Sidebar/SidebarItem.vue +3 -33
  18. package/src/components/SidebarRail/SidebarRailItem.vue +4 -17
  19. package/src/components/Tooltip/Tooltip.vue +8 -0
  20. package/src/components/shared/deferredTrigger.ts +174 -0
  21. package/src/components/shared/navLink.ts +45 -0
  22. package/src/molecules/editor/extensions/attachment/attachment-engine.ts +1 -1
  23. package/src/molecules/editor/extensions/content-paste/paste-html-utils.ts +16 -6
  24. package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +26 -9
  25. package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +35 -16
  26. package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +1 -1
  27. package/src/molecules/editor/extensions/iframe/iframe-extension.ts +30 -30
  28. package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +1 -1
  29. package/src/molecules/editor/extensions/link/link-paste-plugin.ts +1 -1
  30. package/src/molecules/editor/extensions/shared/media-upload-engine.ts +1 -1
  31. package/src/molecules/list/ListRow.vue +8 -1
  32. package/src/utils/dialog.ts +20 -2
  33. package/src/{molecules/editor/extensions/shared → utils}/url-safety.ts +28 -16
  34. package/tailwind/content.js +0 -1
  35. package/tailwind/plugin.js +22 -0
  36. package/vite/doctypeInterfaceGenerator.js +52 -39
  37. package/vitepress/index.node.ts +0 -2
  38. package/experimental/TextEditor/TextEditor.api.md +0 -161
  39. package/experimental/TextEditor/TextEditor.vue +0 -298
  40. package/experimental/TextEditor/classIcon.ts +0 -21
  41. package/experimental/TextEditor/commands.js +0 -344
  42. package/experimental/TextEditor/components/CodeBlockComponent.vue +0 -103
  43. package/experimental/TextEditor/components/FontColor.vue +0 -153
  44. package/experimental/TextEditor/components/ImageViewerModal.vue +0 -463
  45. package/experimental/TextEditor/components/InsertImage.vue +0 -54
  46. package/experimental/TextEditor/components/InsertLink.vue +0 -13
  47. package/experimental/TextEditor/components/InsertVideo.vue +0 -14
  48. package/experimental/TextEditor/components/LinkPopup.vue +0 -99
  49. package/experimental/TextEditor/components/MediaNodeView.vue +0 -398
  50. package/experimental/TextEditor/components/MentionList.vue +0 -95
  51. package/experimental/TextEditor/components/TextEditorBubbleMenu.vue +0 -78
  52. package/experimental/TextEditor/components/TextEditorFixedMenu.vue +0 -78
  53. package/experimental/TextEditor/components/TextEditorFloatingMenu.vue +0 -61
  54. package/experimental/TextEditor/components/TextEditorMenu.vue +0 -218
  55. package/experimental/TextEditor/components/index.js +0 -0
  56. package/experimental/TextEditor/extensions/code-block.ts +0 -119
  57. package/experimental/TextEditor/extensions/color/color-extension.ts +0 -140
  58. package/experimental/TextEditor/extensions/color/color-styles.css +0 -25
  59. package/experimental/TextEditor/extensions/color/index.ts +0 -2
  60. package/experimental/TextEditor/extensions/content-paste-extension.ts +0 -160
  61. package/experimental/TextEditor/extensions/copy-styles.ts +0 -160
  62. package/experimental/TextEditor/extensions/emoji/EmojiList.vue +0 -55
  63. package/experimental/TextEditor/extensions/emoji/emoji-extension.ts +0 -55
  64. package/experimental/TextEditor/extensions/emoji/emojis.json +0 -7422
  65. package/experimental/TextEditor/extensions/heading/heading.ts +0 -20
  66. package/experimental/TextEditor/extensions/highlight/highlight-extension.ts +0 -241
  67. package/experimental/TextEditor/extensions/highlight/highlight-styles.css +0 -31
  68. package/experimental/TextEditor/extensions/highlight/index.ts +0 -2
  69. package/experimental/TextEditor/extensions/iframe/IframeNodeView.vue +0 -308
  70. package/experimental/TextEditor/extensions/iframe/InsertIframe.vue +0 -209
  71. package/experimental/TextEditor/extensions/iframe/iframe-extension.ts +0 -404
  72. package/experimental/TextEditor/extensions/iframe/index.ts +0 -11
  73. package/experimental/TextEditor/extensions/iframe/utils.ts +0 -283
  74. package/experimental/TextEditor/extensions/image/image-extension.ts +0 -661
  75. package/experimental/TextEditor/extensions/image/index.ts +0 -5
  76. package/experimental/TextEditor/extensions/image-group/ImageGroupNodeView.vue +0 -182
  77. package/experimental/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +0 -740
  78. package/experimental/TextEditor/extensions/image-group/image-group-extension.ts +0 -187
  79. package/experimental/TextEditor/extensions/image-viewer-extension.ts +0 -162
  80. package/experimental/TextEditor/extensions/link/index.ts +0 -1
  81. package/experimental/TextEditor/extensions/link/link-extension.ts +0 -323
  82. package/experimental/TextEditor/extensions/link/linkPasteHandler.ts +0 -51
  83. package/experimental/TextEditor/extensions/mention/index.ts +0 -1
  84. package/experimental/TextEditor/extensions/mention/mention-extension.ts +0 -204
  85. package/experimental/TextEditor/extensions/mention/style.css +0 -11
  86. package/experimental/TextEditor/extensions/shared/color-utils.ts +0 -236
  87. package/experimental/TextEditor/extensions/slash-commands/SlashCommandsList.vue +0 -59
  88. package/experimental/TextEditor/extensions/slash-commands/slash-commands-extension.ts +0 -184
  89. package/experimental/TextEditor/extensions/suggestion/SuggestionList.vue +0 -130
  90. package/experimental/TextEditor/extensions/suggestion/createSuggestionExtension.ts +0 -151
  91. package/experimental/TextEditor/extensions/suggestion/index.ts +0 -5
  92. package/experimental/TextEditor/extensions/tag/index.ts +0 -1
  93. package/experimental/TextEditor/extensions/tag/tag-extension.ts +0 -170
  94. package/experimental/TextEditor/extensions/toc-node/TocNodeView.vue +0 -439
  95. package/experimental/TextEditor/extensions/toc-node/index.ts +0 -3
  96. package/experimental/TextEditor/extensions/toc-node/toc-node-extension.ts +0 -167
  97. package/experimental/TextEditor/extensions/video-extension.ts +0 -653
  98. package/experimental/TextEditor/hljs-github.css +0 -197
  99. package/experimental/TextEditor/index.ts +0 -21
  100. package/experimental/TextEditor/style.css +0 -190
  101. package/experimental/TextEditor/types.ts +0 -72
  102. package/experimental/TextEditor/utils.js +0 -11
  103. package/src/utils/url-validation.ts +0 -39
@@ -1,197 +0,0 @@
1
- /* GitHub light / dark syntax-highlight theme for highlight.js.
2
- Selector-agnostic: styles any <pre> containing hljs-annotated tokens.
3
- Used by both the TipTap editor (CodeBlockComponent) and the chat Markdown renderer. */
4
-
5
- /* ── pre shell ────────────────────────────────────────────────── */
6
- .hljs-pre {
7
- background: #f6f8fa;
8
- color: #24292e;
9
- font-family:
10
- ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
11
- 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Mono', 'Source Code Pro', 'Fira Mono',
12
- 'Droid Sans Mono', 'Consolas', 'Courier New', monospace;
13
- font-size: 12px;
14
- line-height: 1.7;
15
- padding: 0.75rem 1rem;
16
- border-radius: 0.75rem;
17
- border: 1px solid var(--outline-gray-2);
18
- caret-color: #24292e;
19
- }
20
-
21
- .hljs-pre code {
22
- color: inherit;
23
- padding: 0;
24
- background: none;
25
- font-size: inherit;
26
- }
27
-
28
- /* ── GitHub light tokens ──────────────────────────────────────── */
29
- .hljs-pre .hljs-doctag,
30
- .hljs-pre .hljs-keyword,
31
- .hljs-pre .hljs-meta .hljs-keyword,
32
- .hljs-pre .hljs-template-tag,
33
- .hljs-pre .hljs-template-variable,
34
- .hljs-pre .hljs-type,
35
- .hljs-pre .hljs-variable.language_ {
36
- color: #d73a49;
37
- }
38
-
39
- .hljs-pre .hljs-title,
40
- .hljs-pre .hljs-title.class_,
41
- .hljs-pre .hljs-title.class_.inherited__,
42
- .hljs-pre .hljs-title.function_ {
43
- color: #6f42c1;
44
- }
45
-
46
- .hljs-pre .hljs-attr,
47
- .hljs-pre .hljs-attribute,
48
- .hljs-pre .hljs-literal,
49
- .hljs-pre .hljs-meta,
50
- .hljs-pre .hljs-number,
51
- .hljs-pre .hljs-operator,
52
- .hljs-pre .hljs-variable,
53
- .hljs-pre .hljs-selector-attr,
54
- .hljs-pre .hljs-selector-class,
55
- .hljs-pre .hljs-selector-id {
56
- color: #005cc5;
57
- }
58
-
59
- .hljs-pre .hljs-regexp,
60
- .hljs-pre .hljs-string,
61
- .hljs-pre .hljs-meta .hljs-string {
62
- color: #032f62;
63
- }
64
-
65
- .hljs-pre .hljs-built_in,
66
- .hljs-pre .hljs-symbol {
67
- color: #e36209;
68
- }
69
-
70
- .hljs-pre .hljs-comment,
71
- .hljs-pre .hljs-code,
72
- .hljs-pre .hljs-formula {
73
- color: #6a737d;
74
- }
75
-
76
- .hljs-pre .hljs-name,
77
- .hljs-pre .hljs-quote,
78
- .hljs-pre .hljs-selector-tag,
79
- .hljs-pre .hljs-selector-pseudo {
80
- color: #22863a;
81
- }
82
-
83
- .hljs-pre .hljs-subst {
84
- color: #24292e;
85
- }
86
- .hljs-pre .hljs-section {
87
- color: #005cc5;
88
- font-weight: bold;
89
- }
90
- .hljs-pre .hljs-bullet {
91
- color: #735c0f;
92
- }
93
- .hljs-pre .hljs-emphasis {
94
- color: #24292e;
95
- font-style: italic;
96
- }
97
- .hljs-pre .hljs-strong {
98
- color: #24292e;
99
- font-weight: 700;
100
- }
101
- .hljs-pre .hljs-addition {
102
- color: #22863a;
103
- background-color: #f0fff4;
104
- }
105
- .hljs-pre .hljs-deletion {
106
- color: #b31d28;
107
- background-color: #ffeef0;
108
- }
109
-
110
- /* ── pre shell — dark mode ───────────────────────────────────── */
111
- [data-theme='dark'] .hljs-pre {
112
- background: #0d1117;
113
- color: #c9d1d9;
114
- caret-color: #c9d1d9;
115
- }
116
-
117
- /* ── GitHub dark tokens ──────────────────────────────────────── */
118
- [data-theme='dark'] .hljs-pre .hljs-doctag,
119
- [data-theme='dark'] .hljs-pre .hljs-keyword,
120
- [data-theme='dark'] .hljs-pre .hljs-meta .hljs-keyword,
121
- [data-theme='dark'] .hljs-pre .hljs-template-tag,
122
- [data-theme='dark'] .hljs-pre .hljs-template-variable,
123
- [data-theme='dark'] .hljs-pre .hljs-type,
124
- [data-theme='dark'] .hljs-pre .hljs-variable.language_ {
125
- color: #ff7b72;
126
- }
127
-
128
- [data-theme='dark'] .hljs-pre .hljs-title,
129
- [data-theme='dark'] .hljs-pre .hljs-title.class_,
130
- [data-theme='dark'] .hljs-pre .hljs-title.class_.inherited__,
131
- [data-theme='dark'] .hljs-pre .hljs-title.function_ {
132
- color: #d2a8ff;
133
- }
134
-
135
- [data-theme='dark'] .hljs-pre .hljs-attr,
136
- [data-theme='dark'] .hljs-pre .hljs-attribute,
137
- [data-theme='dark'] .hljs-pre .hljs-literal,
138
- [data-theme='dark'] .hljs-pre .hljs-meta,
139
- [data-theme='dark'] .hljs-pre .hljs-number,
140
- [data-theme='dark'] .hljs-pre .hljs-operator,
141
- [data-theme='dark'] .hljs-pre .hljs-variable,
142
- [data-theme='dark'] .hljs-pre .hljs-selector-attr,
143
- [data-theme='dark'] .hljs-pre .hljs-selector-class,
144
- [data-theme='dark'] .hljs-pre .hljs-selector-id {
145
- color: #79c0ff;
146
- }
147
-
148
- [data-theme='dark'] .hljs-pre .hljs-regexp,
149
- [data-theme='dark'] .hljs-pre .hljs-string,
150
- [data-theme='dark'] .hljs-pre .hljs-meta .hljs-string {
151
- color: #a5d6ff;
152
- }
153
-
154
- [data-theme='dark'] .hljs-pre .hljs-built_in,
155
- [data-theme='dark'] .hljs-pre .hljs-symbol {
156
- color: #ffa657;
157
- }
158
-
159
- [data-theme='dark'] .hljs-pre .hljs-comment,
160
- [data-theme='dark'] .hljs-pre .hljs-code,
161
- [data-theme='dark'] .hljs-pre .hljs-formula {
162
- color: #8b949e;
163
- }
164
-
165
- [data-theme='dark'] .hljs-pre .hljs-name,
166
- [data-theme='dark'] .hljs-pre .hljs-quote,
167
- [data-theme='dark'] .hljs-pre .hljs-selector-tag,
168
- [data-theme='dark'] .hljs-pre .hljs-selector-pseudo {
169
- color: #7ee787;
170
- }
171
-
172
- [data-theme='dark'] .hljs-pre .hljs-subst {
173
- color: #c9d1d9;
174
- }
175
- [data-theme='dark'] .hljs-pre .hljs-section {
176
- color: #1f6feb;
177
- font-weight: bold;
178
- }
179
- [data-theme='dark'] .hljs-pre .hljs-bullet {
180
- color: #f2cc60;
181
- }
182
- [data-theme='dark'] .hljs-pre .hljs-emphasis {
183
- color: #c9d1d9;
184
- font-style: italic;
185
- }
186
- [data-theme='dark'] .hljs-pre .hljs-strong {
187
- color: #c9d1d9;
188
- font-weight: 700;
189
- }
190
- [data-theme='dark'] .hljs-pre .hljs-addition {
191
- color: #aff5b4;
192
- background-color: #033a16;
193
- }
194
- [data-theme='dark'] .hljs-pre .hljs-deletion {
195
- color: #ffdcd7;
196
- background-color: #67060c;
197
- }
@@ -1,21 +0,0 @@
1
- // @ts-nocheck -- frozen v0 code, kept out of type-check (see tsconfig.app.json)
2
- /** @deprecated Use `Editor` from `frappe-ui/editor` instead. */
3
- export { default } from './TextEditor.vue'
4
-
5
- /** @deprecated Use `Editor` from `frappe-ui/editor` instead. */
6
- export { default as TextEditor } from './TextEditor.vue'
7
-
8
- /** @deprecated Use `EditorBubbleMenu` from `frappe-ui/editor` instead. */
9
- export { default as TextEditorBubbleMenu } from './components/TextEditorBubbleMenu.vue'
10
-
11
- /** @deprecated Use `EditorFixedMenu` from `frappe-ui/editor` instead. */
12
- export { default as TextEditorFixedMenu } from './components/TextEditorFixedMenu.vue'
13
-
14
- /** @deprecated Use `EditorFloatingMenu` from `frappe-ui/editor` instead. */
15
- export { default as TextEditorFloatingMenu } from './components/TextEditorFloatingMenu.vue'
16
-
17
- /** @deprecated Use `EditorContent` from `frappe-ui/editor` instead. */
18
- export { EditorContent as TextEditorContent } from '@tiptap/vue-3'
19
-
20
- /** @deprecated Use toolbar presets and menu items from `frappe-ui/editor` instead. */
21
- export { createEditorButton as createEditorButton } from './utils'
@@ -1,190 +0,0 @@
1
- @import './extensions/color/color-styles.css';
2
- @import './extensions/highlight/highlight-styles.css';
3
-
4
- .ProseMirror {
5
- outline: none;
6
- caret-color: var(--ink-gray-9);
7
- word-break: break-word;
8
- }
9
-
10
- /* Firefox */
11
- .ProseMirror-focused:focus-visible {
12
- outline: none;
13
- }
14
-
15
- /* Placeholder */
16
- .ProseMirror:not(.ProseMirror-focused) p.is-editor-empty::before {
17
- content: attr(data-placeholder);
18
- float: left;
19
- color: var(--ink-gray-4);
20
- pointer-events: none;
21
- height: 0;
22
- }
23
-
24
- .ProseMirror-selectednode video,
25
- img.ProseMirror-selectednode {
26
- outline: 2px solid var(--outline-gray-2);
27
- }
28
-
29
- .table-of-contents-node {
30
- padding: 0 10px;
31
- }
32
- .table-of-contents-node li p {
33
- width: fit-content;
34
- padding: 0 3px;
35
- border-radius: 4px;
36
- }
37
-
38
- .table-of-contents-node li p:hover {
39
- background-color: var(--surface-gray-2);
40
- }
41
-
42
- .table-of-contents-node.ProseMirror-selectednode {
43
- outline: 2px solid var(--outline-gray-2);
44
- outline-offset: 2px;
45
- border-radius: 4px;
46
- }
47
-
48
- .ProseMirror ul[data-type='taskList'] {
49
- list-style: none;
50
- padding: 0;
51
-
52
- li {
53
- align-items: flex-start;
54
- display: flex;
55
- margin: 0;
56
-
57
- > label {
58
- flex: 0 0 auto;
59
- margin-right: 0.5rem;
60
- margin-top: 0.25rem;
61
- height: 1lh;
62
- display: flex;
63
- align-items: center;
64
- user-select: none;
65
- }
66
-
67
- > div {
68
- flex: 1 1 auto;
69
- margin-bottom: 0;
70
-
71
- > p {
72
- margin: 0.25rem 0;
73
- }
74
- }
75
- }
76
- ul[data-type='taskList'] {
77
- margin: 0;
78
- }
79
-
80
- input[type='checkbox'] {
81
- cursor: pointer;
82
- width: 14px;
83
- height: 14px;
84
- border-radius: 4px;
85
- color: var(--ink-gray-9);
86
- }
87
- }
88
-
89
- .resize-cursor {
90
- cursor: ew-resize;
91
- cursor: col-resize;
92
- }
93
-
94
- .tag-item,
95
- .tag-suggestion-active {
96
- background-color: var(--surface-gray-1, #f8f8f8);
97
- color: inherit;
98
- border: 1px solid transparent;
99
- padding: 0px 2px;
100
- border-radius: 4px;
101
- font-size: 1em;
102
- white-space: nowrap;
103
- cursor: default;
104
- }
105
-
106
- .tag-item.ProseMirror-selectednode {
107
- border-color: var(--outline-gray-3, #c7c7c7);
108
- }
109
-
110
- .tag-suggestion-active {
111
- background-color: var(--surface-gray-2, #f3f3f3);
112
- }
113
-
114
- .ProseMirror table {
115
- table-layout: fixed;
116
- }
117
-
118
- .ProseMirror td,
119
- .ProseMirror th {
120
- padding: 0.5rem;
121
- border: 1px solid var(--outline-gray-2);
122
- position: relative;
123
- }
124
-
125
- .ProseMirror td p,
126
- .ProseMirror th p {
127
- margin: 0;
128
- }
129
-
130
- .ProseMirror th {
131
- background-color: var(--surface-gray-2);
132
- }
133
-
134
- /* Applies the current color to the link's underline */
135
- .ProseMirror a span[style] {
136
- text-decoration: underline;
137
- }
138
-
139
- .ProseMirror .tableWrapper {
140
- overflow-x: scroll;
141
- }
142
-
143
- /* Edit prose classes to be more functional */
144
- .prose-v2 {
145
- line-height: 1.5 !important;
146
- blockquote {
147
- quotes: none;
148
- font-style: normal;
149
- margin-top: 0.75em;
150
- margin-bottom: 0.75em;
151
- }
152
-
153
- p,
154
- ul,
155
- ol,
156
- pre,
157
- blockquote,
158
- table {
159
- margin-top: 0;
160
- margin-bottom: 0;
161
- }
162
- /* fix: heading bottom margin */
163
- :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
164
- margin-top: 0;
165
- }
166
- :is(h1, h2, h3, h4, h5, h6):first-child {
167
- margin-top: 0;
168
- }
169
-
170
- hr {
171
- margin: 2.25em 0;
172
- }
173
- }
174
-
175
- /* Empty paragraph height in prose-v3.
176
- ProseMirror always renders empty paragraphs as <p><br class="ProseMirror-trailingBreak"></p>
177
- even in readonly mode, so p:empty never matches.
178
- Edit mode: no override — natural 14px × 1.7 = 23.8px, avoids jump when typing
179
- Readonly mode: scoped via [contenteditable=false] + ProseMirror-trailingBreak class
180
- to precisely target empty paragraphs (not inline <br> in content) */
181
- .ProseMirror[contenteditable='false'] .prose-v3 p:has(> br.ProseMirror-trailingBreak:only-child),
182
- .prose-v3.ProseMirror[contenteditable='false'] p:has(> br.ProseMirror-trailingBreak:only-child) {
183
- line-height: 20px;
184
- }
185
-
186
- /* prose-v3 blockquote: 2px left border — overrides Tailwind Typography's 0.25rem
187
- using element specificity (0,1,1) to beat the plugin's :where() (0,1,0) */
188
- .prose-v3 blockquote {
189
- border-inline-start-width: 2px;
190
- }
@@ -1,72 +0,0 @@
1
- import { type Component } from 'vue'
2
- import { type UploadedFile } from '#utils/useFileUpload'
3
- import { type MentionSuggestionItem } from './extensions/mention/mention-extension'
4
-
5
- type ConfigureMentionOptions =
6
- | {
7
- mentions: MentionSuggestionItem[]
8
- component?: Component
9
- }
10
- | MentionSuggestionItem[]
11
- | null
12
-
13
- export interface TextEditorProps {
14
- /** Initial editor content (HTML/string). `null` renders an empty editor */
15
- content?: string | null
16
-
17
- /** Placeholder text or dynamic placeholder resolver */
18
- placeholder?: string | (() => string)
19
-
20
- /** Custom classes applied to the editor root */
21
- editorClass?: string | string[] | object
22
-
23
- /** Toggles editability of the editor */
24
- editable?: boolean
25
-
26
- /** Autofocus the editor on mount */
27
- autofocus?: boolean
28
-
29
- /** Enables bubble menu or provides custom bubble menu items */
30
- bubbleMenu?: boolean | any[]
31
-
32
- /** Configuration options for the bubble menu */
33
- bubbleMenuOptions?: object
34
-
35
- /** Enables fixed menu or provides custom fixed menu items */
36
- fixedMenu?: boolean | any[]
37
-
38
- /** Enables floating menu or provides custom floating menu items */
39
- floatingMenu?: boolean | any[]
40
-
41
- /** Custom TipTap extensions */
42
- extensions?: any[]
43
-
44
- /** Options passed to TipTap StarterKit */
45
- starterkitOptions?: any
46
-
47
- /** Mention extension configuration */
48
- mentions?: ConfigureMentionOptions
49
-
50
- /** Tag / hashtag configuration */
51
- tags?: any[] | null
52
-
53
- /** Async file upload handler (used for images, files, etc.) */
54
- uploadFunction?: (file: File) => Promise<UploadedFile>
55
-
56
- /** Extra arguments passed to the upload function */
57
- uploadArgs?: object
58
- }
59
-
60
- export interface TextEditorEmits {
61
- /** Fired whenever editor content changes */
62
- change: [content: string]
63
-
64
- /** Fired when the editor gains focus */
65
- focus: [event: FocusEvent]
66
-
67
- /** Fired when the editor loses focus */
68
- blur: [event: FocusEvent]
69
-
70
- /** Fired on every editor transaction */
71
- transaction: [editor: object]
72
- }
@@ -1,11 +0,0 @@
1
- import commands from './commands'
2
-
3
- export function createEditorButton(option) {
4
- if (option instanceof Array) {
5
- return option.map(createEditorButton)
6
- }
7
- if (typeof option == 'object') {
8
- return option
9
- }
10
- return commands[option]
11
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * Validates if the given string is a valid URL, including common protocols,
3
- * relative paths, and anchor links. It also allows an empty string.
4
- *
5
- * @param url The URL string to validate.
6
- * @returns True if the URL is considered valid, false otherwise.
7
- */
8
- export function isValidUrl(url: string): boolean {
9
- if (url === '') {
10
- return true // Allows empty string as per documentation
11
- }
12
-
13
- // Regex for absolute URLs with common schemes (http, https, mailto, tel, //)
14
- // Allows for paths, query strings, and fragments.
15
- if (/^(https?:\/\/|mailto:|tel:|\/\/)[^\s]+$/i.test(url)) {
16
- return true
17
- }
18
-
19
- // Regex for:
20
- // 1. Relative paths (starting with / or .)
21
- // 2. Anchor links (starting with #)
22
- // These allow for most characters except whitespace, as the initial characters
23
- // prevent misinterpretation as a scheme like 'javascript:'.
24
- if (/^([./#][^\s]*)$/i.test(url)) {
25
- return true
26
- }
27
-
28
- // Regex for "Schemeless" paths (e.g., page.html, my-document, slug-name)
29
- // Must start with a word character or hyphen.
30
- // Subsequent characters are restricted to common URL path/query/fragment characters
31
- // (alphanumeric, -, _, ., /, #, ?, =, &, %).
32
- // This prevents colons (avoiding 'javascript:' like schemes) and other problematic
33
- // characters like spaces, (, ), !, {, }.
34
- if (/^[\w\-]([\w\-./#?=&%]*)$/i.test(url)) {
35
- return true
36
- }
37
-
38
- return false
39
- }