tiptapify 0.0.16 → 0.0.18

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 (127) hide show
  1. package/README.md +2 -2
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +25493 -25148
  4. package/dist/tiptapify.umd.js +38 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +1 -1
  7. package/src/components/Tiptapify.vue +3 -3
  8. package/src/components/Toolbar/Index.vue +9 -30
  9. package/src/components/Toolbar/Items.vue +14 -29
  10. package/src/components/Toolbar/actions.ts +18 -0
  11. package/src/components/Toolbar/alignment.ts +28 -0
  12. package/src/components/Toolbar/format.ts +28 -0
  13. package/src/components/Toolbar/formatExtra.ts +33 -0
  14. package/src/components/Toolbar/items.ts +19 -114
  15. package/src/components/Toolbar/list.ts +33 -0
  16. package/src/components/Toolbar/media.ts +33 -0
  17. package/src/components/Toolbar/misc.ts +38 -0
  18. package/src/components/Toolbar/style.ts +38 -0
  19. package/src/components/editorExtensions.ts +8 -6
  20. package/src/components/index.ts +2 -2
  21. package/src/extensions/components/actions/redo/Button.vue +29 -0
  22. package/src/extensions/components/actions/undo/Button.vue +29 -0
  23. package/src/extensions/components/alignment/center/Button.vue +29 -0
  24. package/src/extensions/components/alignment/justify/Button.vue +29 -0
  25. package/src/extensions/components/alignment/left/Button.vue +29 -0
  26. package/src/extensions/components/alignment/right/Button.vue +29 -0
  27. package/src/extensions/components/format/bold/Button.vue +30 -0
  28. package/src/extensions/components/format/italic/Button.vue +30 -0
  29. package/src/extensions/components/format/strike/Button.vue +30 -0
  30. package/src/extensions/components/format/underline/Button.vue +30 -0
  31. package/src/extensions/components/formatExtra/code/Button.vue +30 -0
  32. package/src/extensions/components/formatExtra/codeBlock/Button.vue +30 -0
  33. package/src/extensions/components/formatExtra/quote/Button.vue +30 -0
  34. package/src/extensions/components/formatExtra/sub/Button.vue +30 -0
  35. package/src/extensions/components/formatExtra/sup/Button.vue +30 -0
  36. package/src/extensions/components/list/bullet/Button.vue +30 -0
  37. package/src/extensions/components/list/indent/Button.vue +30 -0
  38. package/src/extensions/components/list/numbered/Button.vue +30 -0
  39. package/src/extensions/components/list/outdent/Button.vue +30 -0
  40. package/src/extensions/components/list/task/Button.vue +30 -0
  41. package/src/extensions/components/{Emoji.vue → media/emoji/Button.vue} +65 -62
  42. package/src/extensions/components/media/image/Button.vue +32 -0
  43. package/src/extensions/components/media/link/Button.vue +34 -0
  44. package/src/extensions/components/media/table/Button.vue +119 -0
  45. package/src/extensions/components/media/table/ColumnActions.vue +52 -0
  46. package/src/extensions/components/media/table/RowActions.vue +52 -0
  47. package/src/extensions/components/media/video/Button.vue +32 -0
  48. package/src/extensions/components/media/video/index.ts +32 -0
  49. package/src/extensions/components/misc/break/Button.vue +25 -0
  50. package/src/extensions/components/misc/formatClear/Button.vue +29 -0
  51. package/src/extensions/components/misc/invisibleChar/Button.vue +30 -0
  52. package/src/extensions/components/misc/line/Button.vue +25 -0
  53. package/src/extensions/components/misc/preview/Button.vue +36 -0
  54. package/src/extensions/components/misc/source/Button.vue +31 -0
  55. package/src/extensions/components/{ShowSourceDialog.vue → misc/source/ShowSourceDialog.vue} +5 -14
  56. package/src/extensions/components/{StyleColor.vue → style/StyleColor.vue} +5 -8
  57. package/src/extensions/components/style/color/Button.vue +57 -0
  58. package/src/extensions/components/style/fontFamily/Button.vue +60 -0
  59. package/src/extensions/components/style/fontFamily/FontFamily.vue +76 -0
  60. package/src/extensions/components/style/fontSize/Button.vue +64 -0
  61. package/src/extensions/components/{FontSize.vue → style/fontSize/FontSize.vue} +0 -5
  62. package/src/extensions/components/style/heading/Button.vue +61 -0
  63. package/src/extensions/components/style/highlight/Button.vue +57 -0
  64. package/src/extensions/components/style/lineHeight/Button.vue +60 -0
  65. package/src/extensions/components/{LineHeight.vue → style/lineHeight/LineHeight.vue} +0 -4
  66. package/src/types/toolbarSections.ts +16 -2
  67. package/src/components/Toolbar/Group.vue +0 -42
  68. package/src/components/Toolbar/GroupBtn.vue +0 -32
  69. package/src/components/Toolbar/GroupDropdown.vue +0 -67
  70. package/src/components/Toolbar/defaultExtensionComponents.ts +0 -65
  71. package/src/composables/Toolbar/Actions/useRedo.ts +0 -22
  72. package/src/composables/Toolbar/Actions/useUndo.ts +0 -22
  73. package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +0 -23
  74. package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +0 -23
  75. package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +0 -23
  76. package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +0 -23
  77. package/src/composables/Toolbar/Format/useBold.ts +0 -23
  78. package/src/composables/Toolbar/Format/useItalic.ts +0 -23
  79. package/src/composables/Toolbar/Format/useStrike.ts +0 -23
  80. package/src/composables/Toolbar/Format/useUnderline.ts +0 -23
  81. package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +0 -23
  82. package/src/composables/Toolbar/FormatExtra/useCode.ts +0 -23
  83. package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +0 -23
  84. package/src/composables/Toolbar/FormatExtra/useSub.ts +0 -23
  85. package/src/composables/Toolbar/FormatExtra/useSup.ts +0 -23
  86. package/src/composables/Toolbar/List/useBullet.ts +0 -22
  87. package/src/composables/Toolbar/List/useIndent.ts +0 -23
  88. package/src/composables/Toolbar/List/useNumbered.ts +0 -22
  89. package/src/composables/Toolbar/List/useOutdent.ts +0 -23
  90. package/src/composables/Toolbar/List/useTask.ts +0 -22
  91. package/src/composables/Toolbar/Media/useEmoji.ts +0 -19
  92. package/src/composables/Toolbar/Media/useImage.ts +0 -23
  93. package/src/composables/Toolbar/Media/useLink.ts +0 -23
  94. package/src/composables/Toolbar/Media/useTable.ts +0 -187
  95. package/src/composables/Toolbar/Media/useVideo.ts +0 -22
  96. package/src/composables/Toolbar/Misc/useBreak.ts +0 -20
  97. package/src/composables/Toolbar/Misc/useFormatClear.ts +0 -22
  98. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +0 -22
  99. package/src/composables/Toolbar/Misc/useLine.ts +0 -20
  100. package/src/composables/Toolbar/Misc/usePreview.ts +0 -19
  101. package/src/composables/Toolbar/Misc/useSource.ts +0 -20
  102. package/src/composables/Toolbar/Style/useColor.ts +0 -35
  103. package/src/composables/Toolbar/Style/useFontFamily.ts +0 -48
  104. package/src/composables/Toolbar/Style/useFontSize.ts +0 -49
  105. package/src/composables/Toolbar/Style/useHeading.ts +0 -63
  106. package/src/composables/Toolbar/Style/useHighlight.ts +0 -35
  107. package/src/composables/Toolbar/Style/useLineHeight.ts +0 -48
  108. package/src/composables/Toolbar/useActionsItems.ts +0 -9
  109. package/src/composables/Toolbar/useAlignmentItems.ts +0 -13
  110. package/src/composables/Toolbar/useFormatExtraItems.ts +0 -15
  111. package/src/composables/Toolbar/useFormatItems.ts +0 -13
  112. package/src/composables/Toolbar/useListItems.ts +0 -15
  113. package/src/composables/Toolbar/useMediaItems.ts +0 -15
  114. package/src/composables/Toolbar/useMiscItems.ts +0 -17
  115. package/src/composables/Toolbar/useStyleItems.ts +0 -17
  116. package/src/extensions/components/PreviewDialog.vue +0 -43
  117. package/src/types/extensionComponents.ts +0 -22
  118. package/src/types/toolbarItems.ts +0 -41
  119. /package/src/extensions/components/{ImageDialog.vue → media/image/ImageDialog.vue} +0 -0
  120. /package/src/extensions/{image.ts → components/media/image/index.ts} +0 -0
  121. /package/src/extensions/components/{LinkDialog.vue → media/link/LinkDialog.vue} +0 -0
  122. /package/src/extensions/{link.ts → components/media/link/index.ts} +0 -0
  123. /package/src/extensions/components/{TableBuilder.vue → media/table/TableBuilder.vue} +0 -0
  124. /package/src/extensions/components/{VideoDialog.vue → media/video/VideoDialog.vue} +0 -0
  125. /package/src/extensions/{preview.ts → components/misc/preview/index.ts} +0 -0
  126. /package/src/extensions/{view-source.ts → components/misc/source/index.ts} +0 -0
  127. /package/src/extensions/components/{FontFamily.vue → style/lineHeight/FontFamily.vue} +0 -0
@@ -1,22 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useTask() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: computed(() => t('lists.task')),
12
- tooltip: computed(() => t('lists.task')),
13
- icon: `mdiSvg:${mdi.mdiFormatListChecks}`,
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.value.isActive('taskList') ? 'primary' : ''),
17
- },
18
- attrs: {
19
- click: () => editor.value.chain().focus().toggleTaskList().run()
20
- }
21
- }
22
- }
@@ -1,19 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import Emoji from "@tiptapify/extensions/components/Emoji.vue";
3
- import { computed, inject, markRaw } from "vue";
4
-
5
- export function useEmoji() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- return {
9
- name: computed(() => t('media.emoji.title')),
10
- tooltip: computed(() => t('media.emoji.title')),
11
- icon: `mdiSvg:${mdi.mdiEmoticon}`,
12
- enabled: true,
13
- component: markRaw(Emoji),
14
- props: {
15
- persistent: false,
16
- closeOnContentClick: false,
17
- }
18
- }
19
- }
@@ -1,23 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useImage() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: computed(() => t('media.image')),
12
- tooltip: computed(() => t('media.image')),
13
- icon: `mdiSvg:${mdi.mdiImage}`,
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.value.isActive('image') ? 'primary' : ''),
17
- disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
18
- },
19
- attrs: {
20
- click: () => editor.value.commands.showTiptapifyImage()
21
- }
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useLink() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: computed(() => t('media.link')),
12
- tooltip: computed(() => t('media.link')),
13
- icon: computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${mdi.mdiLinkOff}` : `mdiSvg:${mdi.mdiLink}`),
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.value.isActive('tiptapifyLink') ? 'primary' : ''),
17
- disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
18
- },
19
- attrs: {
20
- click: () => editor.value.commands.showLink()
21
- }
22
- }
23
- }
@@ -1,187 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import TableBuilder from "@tiptapify/extensions/components/TableBuilder.vue";
4
- import { computed, inject, markRaw, Ref } from "vue";
5
-
6
- export function useTable() {
7
- const { t } = inject('tiptapifyI18n') as any
8
-
9
- const editor = inject('tiptapifyEditor') as Ref<Editor>
10
-
11
- return {
12
- name: 'tables',
13
- tooltip: computed(() => t('media.tables.table')),
14
- icon: `mdiSvg:${mdi.mdiTable}`,
15
- modelValue: false,
16
- enabled: true,
17
- props: {
18
- color: computed(() => editor.value.isActive('table') ? 'primary' : ''),
19
- disabled: computed(() => !editor.value.can().chain().focus().insertTable().run()),
20
- },
21
- children: [
22
- {
23
- name: 'insert table',
24
- tooltip: computed(() => t('media.tables.insertTable')),
25
- icon: `mdiSvg:${mdi.mdiTablePlus}`,
26
- enabled: true,
27
- props: {
28
- disabled: computed(() => !editor.value.can().chain().focus().insertTable().run()),
29
- activator: 'parent',
30
- openOnClick: true,
31
- openOnHover: false,
32
- closeOnContentClick: false,
33
- submenu: true
34
- },
35
- component: markRaw(TableBuilder),
36
- },
37
- {
38
- name: 'delete table',
39
- tooltip: computed(() => t('media.tables.deleteTable')),
40
- icon: `mdiSvg:${mdi.mdiTableMinus}`,
41
- enabled: true,
42
- props: {
43
- disabled: computed(() => !editor.value.can().chain().focus().deleteTable().run()),
44
- },
45
- attrs: {
46
- click: () => editor.value.chain().focus().deleteTable().run()
47
- }
48
- },
49
- {
50
- name: 'table row',
51
- tooltip: computed(() => t('media.tables.row')),
52
- icon: `mdiSvg:${mdi.mdiTableRow}`,
53
- enabled: true,
54
- props: {
55
- disabled: computed(
56
- () =>
57
- !editor.value.can().chain().focus().addRowBefore().run() &&
58
- !editor.value.can().chain().focus().addRowAfter().run() &&
59
- !editor.value.can().chain().focus().deleteRow().run()
60
- ),
61
- openOnHover: true,
62
- openOnClick: true,
63
- activator: 'parent',
64
- submenu: true
65
- },
66
- children: [
67
- {
68
- name: 'insert row before',
69
- tooltip: computed(() => t('media.tables.insertRowBefore')),
70
- icon: `mdiSvg:${mdi.mdiTableRowPlusBefore}`,
71
- enabled: true,
72
- props: {
73
- disabled: computed(() => !editor.value.can().chain().focus().addRowBefore().run()),
74
- },
75
- attrs: {
76
- click: () => editor.value.chain().focus().addRowBefore().run()
77
- }
78
- },
79
- {
80
- name: 'insert row after',
81
- tooltip: computed(() => t('media.tables.insertRowAfter')),
82
- icon: `mdiSvg:${mdi.mdiTableRowPlusAfter}`,
83
- enabled: true,
84
- props: {
85
- disabled: computed(() => !editor.value.can().chain().focus().addRowAfter().run()),
86
- },
87
- attrs: {
88
- click: () => editor.value.chain().focus().addRowAfter().run()
89
- }
90
- },
91
- {
92
- name: 'delete row',
93
- tooltip: computed(() => t('media.tables.deleteRow')),
94
- icon: `mdiSvg:${mdi.mdiTableRowRemove}`,
95
- enabled: true,
96
- props: {
97
- disabled: computed(() => !editor.value.can().chain().focus().deleteRow().run()),
98
- },
99
- attrs: {
100
- click: () => editor.value.chain().focus().deleteRow().run()
101
- }
102
- },
103
- ]
104
- },
105
- {
106
- name: 'column',
107
- tooltip: computed(() => t('media.tables.col')),
108
- icon: `mdiSvg:${mdi.mdiTableColumn}`,
109
- enabled: true,
110
- props: {
111
- disabled: computed(
112
- () =>
113
- !editor.value.can().chain().focus().addColumnBefore().run() &&
114
- !editor.value.can().chain().focus().addColumnAfter().run() &&
115
- !editor.value.can().chain().focus().deleteColumn().run()
116
- ),
117
- openOnHover: true,
118
- openOnClick: true,
119
- activator: 'parent',
120
- submenu: true
121
- },
122
- children: [
123
- {
124
- name: 'insert col before',
125
- tooltip: computed(() => t('media.tables.insertColBefore')),
126
- icon: `mdiSvg:${mdi.mdiTableColumnPlusBefore}`,
127
- enabled: true,
128
- props: {
129
- disabled: computed(() => !editor.value.can().chain().focus().addColumnBefore().run()),
130
- },
131
- attrs: {
132
- click: () => editor.value.chain().focus().addColumnBefore().run()
133
- }
134
- },
135
- {
136
- name: 'insert column after',
137
- tooltip: computed(() => t('media.tables.insertColAfter')),
138
- icon: `mdiSvg:${mdi.mdiTableColumnPlusAfter}`,
139
- enabled: true,
140
- props: {
141
- disabled: computed(() => !editor.value.can().chain().focus().addColumnAfter().run()),
142
- },
143
- attrs: {
144
- click: () => editor.value.chain().focus().addColumnAfter().run()
145
- }
146
- },
147
- {
148
- name: 'delete column',
149
- tooltip: computed(() => t('media.tables.deleteCol')),
150
- icon: `mdiSvg:${mdi.mdiTableColumnRemove}`,
151
- enabled: true,
152
- props: {
153
- disabled: computed(() => !editor.value.can().chain().focus().deleteColumn().run()),
154
- },
155
- attrs: {
156
- click: () => editor.value.chain().focus().deleteColumn().run()
157
- }
158
- }
159
- ]
160
- },
161
- {
162
- name: 'merge cells',
163
- tooltip: computed(() => t('media.tables.mergeCells')),
164
- icon: `mdiSvg:${mdi.mdiTableMergeCells}`,
165
- enabled: true,
166
- props: {
167
- disabled: computed(() => !editor.value.can().chain().focus().mergeCells().run()),
168
- },
169
- attrs: {
170
- click: () => editor.value.chain().focus().mergeCells().run()
171
- }
172
- },
173
- {
174
- name: 'split cell',
175
- tooltip: computed(() => t('media.tables.splitCell')),
176
- icon: `mdiSvg:${mdi.mdiTableSplitCell}`,
177
- enabled: true,
178
- props: {
179
- disabled: computed(() => !editor.value.can().chain().focus().splitCell().run()),
180
- },
181
- attrs: {
182
- click: () => editor.value.chain().focus().splitCell().run()
183
- }
184
- }
185
- ]
186
- }
187
- }
@@ -1,22 +0,0 @@
1
- import { Editor } from "@tiptap/vue-3";
2
- import { computed, inject, Ref } from "vue";
3
-
4
- export function useVideo() {
5
- const { t } = inject('tiptapifyI18n') as any
6
-
7
- const editor = inject('tiptapifyEditor') as Ref<Editor>
8
-
9
- return {
10
- name: computed(() => t('media.video')),
11
- tooltip: computed(() => t('media.video')),
12
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M4 6H2v14a2 2 0 0 0 2 2h14v-2H4zm16-4H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2m-8 12.5v-9l6 4.5z"/></svg>',
13
- enabled: true,
14
- props: {
15
- color: computed(() => editor.value.isActive('youtube') ? 'primary' : ''),
16
- disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
17
- },
18
- attrs: {
19
- click: () => editor.value.commands.showTiptapifyVideo()
20
- }
21
- }
22
- }
@@ -1,20 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useBreak() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: 'break',
12
- tooltip: computed(() => t('format.break')),
13
- icon: `mdiSvg:${mdi.mdiFormatPageBreak}`,
14
- enabled: true,
15
- props: {},
16
- attrs: {
17
- click: () => editor.value.chain().focus().setHardBreak().run()
18
- }
19
- }
20
- }
@@ -1,22 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useFormatClear() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: 'format clear',
12
- tooltip: computed(() => t('format.formatClear')),
13
- icon: `mdiSvg:${mdi.mdiFormatClear}`,
14
- enabled: true,
15
- props: {
16
- disabled: computed(() => !editor.value.can().chain().focus().unsetAllMarks().run()),
17
- },
18
- attrs: {
19
- click: () => editor.value.chain().focus().unsetAllMarks().clearNodes().run()
20
- }
21
- }
22
- }
@@ -1,22 +0,0 @@
1
- import { Editor } from "@tiptap/vue-3";
2
- import { computed, inject, Ref } from "vue";
3
-
4
- export function useInvisibleCharacters() {
5
- const { t } = inject('tiptapifyI18n') as any
6
-
7
- const editor = inject('tiptapifyEditor') as Ref<Editor>
8
-
9
- return {
10
- name: 'show/hide invisible characters',
11
- tooltip: computed(() => t('misc.toggleInvisibleCharacters')),
12
- svg: true,
13
- icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path fill="currentColor" d="M256 64L512 64C529.7 64 544 78.3 544 96C544 113.7 529.7 128 512 128L480 128L480 544C480 561.7 465.7 576 448 576C430.3 576 416 561.7 416 544L416 128L368 128L368 544C368 561.7 353.7 576 336 576C318.3 576 304 561.7 304 544L304 384L256 384C167.6 384 96 312.4 96 224C96 135.6 167.6 64 256 64z"/></svg>`,
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.value.storage.invisibleCharacters.visibility() ? 'primary' : ''),
17
- },
18
- attrs: {
19
- click: () => editor.value.commands.toggleInvisibleCharacters()
20
- }
21
- }
22
- }
@@ -1,20 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useLine() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: 'line',
12
- tooltip: computed(() => t('format.line')),
13
- icon: `mdiSvg:${mdi.mdiMinus}`,
14
- enabled: true,
15
- props: {},
16
- attrs: {
17
- click: () => editor.value.chain().focus().setHorizontalRule().run()
18
- }
19
- }
20
- }
@@ -1,19 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function usePreview() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: 'preview',
12
- tooltip: computed(() => t('misc.preview')),
13
- icon: `mdiSvg:${mdi.mdiFileEyeOutline}`,
14
- enabled: true,
15
- attrs: {
16
- click: () => editor.value.commands.showPreview()
17
- }
18
- }
19
- }
@@ -1,20 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref } from "vue";
4
-
5
- export function useSource() {
6
- const { t } = inject('tiptapifyI18n') as any
7
-
8
- const editor = inject('tiptapifyEditor') as Ref<Editor>
9
-
10
- return {
11
- name: 'source',
12
- tooltip: computed(() => t('misc.source')),
13
- icon: `mdiSvg:${mdi.mdiCodeTags}`,
14
- enabled: true,
15
- props: {},
16
- attrs: {
17
- click: () => editor.value.commands.showSource()
18
- }
19
- }
20
- }
@@ -1,35 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
4
- import { computed, inject, markRaw, Ref } from "vue";
5
-
6
- export function useColor(theme: any) {
7
- const { t } = inject('tiptapifyI18n') as any
8
-
9
- const editor = inject('tiptapifyEditor') as Ref<Editor>
10
-
11
- return {
12
- name: 'color',
13
- tooltip: computed(() => t('style.color.text')),
14
- icon: `mdiSvg:${mdi.mdiFormatColorText}`,
15
- icon2: `mdiSvg:${mdi.mdiColorHelper}`,
16
- enabled: true,
17
- props: {
18
- disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
19
- },
20
- icon2Props: {
21
- disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
22
- color: computed(() => {
23
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
24
- return editor.value.getAttributes('textStyle').color || defaultColor
25
- }),
26
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
27
- },
28
- component: markRaw(StyleColor),
29
- componentProps: {
30
- fontColor: true,
31
- backgroundColor: false,
32
- color: computed(() => editor.value.getAttributes('textStyle').color || ''),
33
- }
34
- }
35
- }
@@ -1,48 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { fonts } from "@tiptapify/constants/style";
4
- import FontFamily from "@tiptapify/extensions/components/FontFamily.vue";
5
- import { computed, inject, markRaw, Ref } from "vue";
6
-
7
- export function useFontFamily() {
8
- const { t } = inject('tiptapifyI18n') as any
9
-
10
- const editor = inject('tiptapifyEditor') as Ref<Editor>
11
-
12
- return {
13
- name: 'font-family',
14
- tooltip: computed(() => t('style.fontFamily')),
15
- icon: `mdiSvg:${mdi.mdiFormatFont}`,
16
- modelValue: false,
17
- enabled: true,
18
- props: {
19
- disabled: computed(() => !editor.value.can().chain().focus().unsetFontFamily().run()),
20
- color: computed(() => {
21
- let color = ''
22
- for (const font in fonts) {
23
- if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
24
- color = 'primary'
25
- break;
26
- }
27
- }
28
-
29
- return color
30
- }),
31
- },
32
- component: markRaw(FontFamily),
33
- componentProps: {
34
- fonts: fonts,
35
- fontFamily: computed(() => {
36
- let fontFamily = ''
37
- for (const font in fonts) {
38
- if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
39
- fontFamily = fonts[font].fontFamily
40
- break;
41
- }
42
- }
43
-
44
- return fontFamily
45
- }),
46
- }
47
- }
48
- }
@@ -1,49 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { fontSizes } from "@tiptapify/constants/style";
4
- import FontSize from "@tiptapify/extensions/components/FontSize.vue";
5
- import { computed, inject, markRaw, Ref } from "vue";
6
-
7
- export function useFontSize(fontMeasure: string) {
8
- const { t } = inject('tiptapifyI18n') as any
9
-
10
- const editor = inject('tiptapifyEditor') as Ref<Editor>
11
-
12
- return {
13
- name: 'font-size',
14
- tooltip: computed(() => t('style.fontSize')),
15
- icon: `mdiSvg:${mdi.mdiFormatSize}`,
16
- modelValue: false,
17
- enabled: true,
18
- props: {
19
- disabled: computed(() => !editor.value.can().chain().focus().unsetFontSize().run()),
20
- color: computed(() => {
21
- let color = ''
22
- for (const size of fontSizes) {
23
- if (editor.value.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
24
- color = 'primary'
25
- break;
26
- }
27
- }
28
-
29
- return color
30
- }),
31
- },
32
- component: markRaw(FontSize),
33
- componentProps: {
34
- sizes: fontSizes,
35
- measure: fontMeasure,
36
- fontSize: computed(() => {
37
- let fontSize = null
38
- for (const size of fontSizes) {
39
- if (editor.value.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
40
- fontSize = size
41
- break;
42
- }
43
- }
44
-
45
- return fontSize
46
- }),
47
- }
48
- }
49
- }
@@ -1,63 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Level } from "@tiptap/extension-heading";
3
- import { Editor } from "@tiptap/vue-3";
4
- import { headingLevels, setHeadingLevels } from "@tiptapify/constants/style";
5
- import { computed, inject, Ref } from "vue";
6
-
7
- interface MDIIcons {
8
- [key: string]: string
9
- }
10
- const mdiIcons = mdi as MDIIcons
11
-
12
- export function useHeading(customHeadingLevels: Array<number> = []) {
13
- const { t } = inject('tiptapifyI18n') as any
14
-
15
- setHeadingLevels(customHeadingLevels)
16
-
17
- const editor = inject('tiptapifyEditor') as Ref<Editor>
18
-
19
- return {
20
- name: 'heading',
21
- tooltip: computed(() => t('style.heading')),
22
- icon: `mdiSvg:${mdi.mdiFormatHeaderPound}`,
23
- modelValue: null,
24
- enabled: true,
25
- props: {
26
- color: computed(() => editor.value.isActive('heading') || editor.value.isActive('paragraph') ? 'primary' : ''),
27
- },
28
- children: [
29
- {
30
- name: 'paragraph',
31
- tooltip: computed(() => t('style.paragraph')),
32
- // icon: mdiIcons['mdiFormatParagraph'],
33
- icon: `mdiSvg:${mdiIcons['mdiFormatParagraph']}`,
34
- noI18n: true,
35
- enabled: true,
36
- props: {
37
- color: computed(() => editor.value.isActive('paragraph') ? 'primary' : ''),
38
- },
39
- attrs: {
40
- click: () => editor.value.chain().focus().setParagraph().run()
41
- }
42
- }
43
- ].concat(
44
- headingLevels.value.map(level => {
45
- const headingLevel: Level = level as Level
46
- return {
47
- name: `H${level}`,
48
- tooltip: computed(() => t(`style.headings.h${level}`)),
49
- // icon: mdiIcons[`mdiFormatHeader${level}`],
50
- icon: `mdiSvg:${mdiIcons[`mdiFormatHeader${level}`]}`,
51
- noI18n: true,
52
- enabled: true,
53
- props: {
54
- color: computed(() => editor.value.isActive('heading', {level: level}) ? 'primary' : ''),
55
- },
56
- attrs: {
57
- click: () => editor.value.chain().focus().toggleHeading({level: headingLevel}).run()
58
- }
59
- }
60
- })
61
- )
62
- }
63
- }
@@ -1,35 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
4
- import { computed, inject, markRaw, Ref } from "vue";
5
-
6
- export function useHighlight(theme: any) {
7
- const { t } = inject('tiptapifyI18n') as any
8
-
9
- const editor = inject('tiptapifyEditor') as Ref<Editor>
10
-
11
- return {
12
- name: 'highlight',
13
- tooltip: computed(() => t('style.color.highlight')),
14
- icon: `mdiSvg:${mdi.mdiFormatColorFill}`,
15
- icon2: `mdiSvg:${mdi.mdiColorHelper}`,
16
- enabled: true,
17
- props: {
18
- disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
19
- },
20
- icon2Props: {
21
- disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
22
- color: computed(() => {
23
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
24
- return editor.value.getAttributes('highlight').color || defaultColor
25
- }),
26
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
27
- },
28
- component: markRaw(StyleColor),
29
- componentProps: {
30
- fontColor: false,
31
- backgroundColor: true,
32
- color: computed(() => editor.value.getAttributes('highlight').color || ''),
33
- }
34
- }
35
- }