tiptapify 0.0.10 → 0.0.12
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/README.md +7 -3
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +18524 -17801
- package/dist/tiptapify.umd.js +77 -38
- package/index.d.ts +2 -2
- package/package.json +41 -40
- package/src/components/MenuBubble.vue +8 -8
- package/src/components/Tiptapify.vue +5 -6
- package/src/components/Toolbar/Group.vue +2 -2
- package/src/components/Toolbar/GroupBtn.vue +12 -9
- package/src/components/Toolbar/GroupDropdown.vue +5 -19
- package/src/components/Toolbar/Index.vue +13 -9
- package/src/components/Toolbar/Items.vue +5 -8
- package/src/components/Toolbar/Toggle.vue +3 -5
- package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
- package/src/components/Toolbar/items.ts +53 -70
- package/src/components/UI/BtnIcon.vue +24 -0
- package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
- package/src/components/editorExtensions.ts +17 -2
- package/src/components/index.ts +8 -2
- package/src/composables/Toolbar/Actions/useRedo.ts +23 -0
- package/src/composables/Toolbar/Actions/useUndo.ts +23 -0
- package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +24 -0
- package/src/composables/Toolbar/Format/useBold.ts +24 -0
- package/src/composables/Toolbar/Format/useItalic.ts +24 -0
- package/src/composables/Toolbar/Format/useStrike.ts +24 -0
- package/src/composables/Toolbar/Format/useUnderline.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useCode.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useSub.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useSup.ts +24 -0
- package/src/composables/Toolbar/List/useBullet.ts +23 -0
- package/src/composables/Toolbar/List/useIndent.ts +24 -0
- package/src/composables/Toolbar/List/useNumbered.ts +23 -0
- package/src/composables/Toolbar/List/useOutdent.ts +24 -0
- package/src/composables/Toolbar/List/useTask.ts +23 -0
- package/src/composables/Toolbar/Media/useImage.ts +24 -0
- package/src/composables/Toolbar/Media/useLink.ts +24 -0
- package/src/composables/Toolbar/Media/useTable.ts +188 -0
- package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
- package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
- package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
- package/src/composables/Toolbar/Misc/useLine.ts +21 -0
- package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
- package/src/composables/Toolbar/Misc/useSource.ts +21 -0
- package/src/composables/Toolbar/Style/useColor.ts +36 -0
- package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
- package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
- package/src/composables/Toolbar/Style/useHeading.ts +64 -0
- package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
- package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
- package/src/composables/Toolbar/useActionsItems.ts +9 -0
- package/src/composables/Toolbar/useAlignmentItems.ts +13 -0
- package/src/composables/Toolbar/useFormatExtraItems.ts +15 -0
- package/src/composables/Toolbar/useFormatItems.ts +13 -0
- package/src/composables/Toolbar/useListItems.ts +15 -0
- package/src/composables/Toolbar/useMediaItems.ts +11 -0
- package/src/composables/Toolbar/useMiscItems.ts +17 -0
- package/src/composables/Toolbar/useStyleItems.ts +17 -0
- package/src/{components/Toolbar/fonts.ts → constants/style.ts} +21 -0
- package/src/extensions/components/FontFamily.vue +82 -0
- package/src/extensions/components/FontSize.vue +83 -0
- package/src/extensions/components/ImageDialog.vue +7 -3
- package/src/extensions/components/LineHeight.vue +82 -0
- package/src/extensions/components/LinkDialog.vue +27 -7
- package/src/extensions/components/PreviewDialog.vue +11 -4
- package/src/extensions/components/ShowSourceDialog.vue +10 -6
- package/src/extensions/components/StyleColor.vue +2 -2
- package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
- package/src/extensions/image.ts +2 -1
- package/src/extensions/link.ts +10 -1
- package/src/extensions/preview.ts +2 -1
- package/src/extensions/slash-commands.ts +1 -1
- package/src/extensions/view-source.ts +2 -1
- package/src/i18n/locales/ch.json +84 -82
- package/src/i18n/locales/cz.json +32 -30
- package/src/i18n/locales/de.json +28 -26
- package/src/i18n/locales/en.json +3 -1
- package/src/i18n/locales/es.json +30 -28
- package/src/i18n/locales/fr.json +30 -28
- package/src/i18n/locales/it.json +32 -30
- package/src/i18n/locales/la.json +61 -59
- package/src/i18n/locales/lt.json +38 -36
- package/src/i18n/locales/nl.json +31 -29
- package/src/i18n/locales/pl.json +32 -30
- package/src/i18n/locales/pt.json +29 -27
- package/src/i18n/locales/ru.json +3 -1
- package/src/i18n/locales/se.json +30 -28
- package/src/i18n/locales/ua.json +3 -1
- package/src/index.ts +3 -1
- package/src/types/extensionComponents.ts +22 -0
- package/src/types/toolbarItems.ts +43 -0
- package/src/types/toolbarSections.ts +11 -0
- package/src/components/Toolbar/items/actions.ts +0 -32
- package/src/components/Toolbar/items/alignment.ts +0 -60
- package/src/components/Toolbar/items/format.ts +0 -60
- package/src/components/Toolbar/items/formatExtra.ts +0 -73
- package/src/components/Toolbar/items/list.ts +0 -70
- package/src/components/Toolbar/items/media.ts +0 -211
- package/src/components/Toolbar/items/misc.ts +0 -59
- package/src/components/Toolbar/items/style.ts +0 -204
- package/src/types/overridable-extensions.ts +0 -6
- /package/src/{components → extensions/components}/CodeBlockComponent.vue +0 -0
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import * as mdi from "@mdi/js";
|
|
2
|
-
import { Editor } from "@tiptap/vue-3";
|
|
3
|
-
import { fonts } from "@tiptapify/components/Toolbar/fonts";
|
|
4
|
-
import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
|
|
5
|
-
import { computed, markRaw, ref } from "vue";
|
|
6
|
-
|
|
7
|
-
interface MDIIcons {
|
|
8
|
-
[key: string]: string
|
|
9
|
-
}
|
|
10
|
-
const mdiIcons = mdi as MDIIcons
|
|
11
|
-
|
|
12
|
-
export function getStyleItems(editor: Editor, theme: any, fontMeasure: string, customHeadingLevels: Array<number> = []) {
|
|
13
|
-
const headingLevels = ref([1, 2, 3, 4, 5, 6])
|
|
14
|
-
if (customHeadingLevels.length) {
|
|
15
|
-
customHeadingLevels.forEach(level => {
|
|
16
|
-
if (level <= 0 || level > 6) {
|
|
17
|
-
throw new Error('customHeadingLevels must be between 1 and 6')
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
headingLevels.value = customHeadingLevels
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const fontSizes = [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 32, 48, 64, 96]
|
|
25
|
-
|
|
26
|
-
const lineHeights = [1, 1.5, 2, 3, 4]
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
heading: {
|
|
30
|
-
name: 'heading',
|
|
31
|
-
tooltip: 'style.heading',
|
|
32
|
-
icon: mdi.mdiFormatHeaderPound,
|
|
33
|
-
modelValue: null,
|
|
34
|
-
enabled: true,
|
|
35
|
-
props: {
|
|
36
|
-
color: computed(() => editor.isActive('heading') || editor.isActive('paragraph') ? 'primary' : ''),
|
|
37
|
-
},
|
|
38
|
-
children: [
|
|
39
|
-
{
|
|
40
|
-
name: `paragraph`,
|
|
41
|
-
tooltip: `style.paragraph`,
|
|
42
|
-
icon: mdiIcons[`mdiFormatParagraph`],
|
|
43
|
-
noI18n: true,
|
|
44
|
-
enabled: true,
|
|
45
|
-
props: {
|
|
46
|
-
color: computed(() => editor.isActive('paragraph') ? 'primary' : ''),
|
|
47
|
-
},
|
|
48
|
-
attrs: {
|
|
49
|
-
click: () => editor.chain().focus().setParagraph().run()
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
].concat(
|
|
53
|
-
headingLevels.value.map(level => {
|
|
54
|
-
return {
|
|
55
|
-
name: `H${level}`,
|
|
56
|
-
tooltip: `style.headings.h${level}`,
|
|
57
|
-
icon: mdiIcons[`mdiFormatHeader${level}`],
|
|
58
|
-
noI18n: true,
|
|
59
|
-
enabled: true,
|
|
60
|
-
props: {
|
|
61
|
-
color: computed(() => editor.isActive('heading', { level: level }) ? 'primary' : ''),
|
|
62
|
-
},
|
|
63
|
-
attrs: {
|
|
64
|
-
click: () => editor.chain().focus().toggleHeading({ level }).run()
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
)
|
|
69
|
-
},
|
|
70
|
-
fontFamily: {
|
|
71
|
-
name: 'font-family',
|
|
72
|
-
tooltip: 'style.fontFamily',
|
|
73
|
-
icon: mdi.mdiFormatFont,
|
|
74
|
-
modelValue: false,
|
|
75
|
-
enabled: true,
|
|
76
|
-
props: {
|
|
77
|
-
disabled: computed(() => !editor.can().chain().focus().unsetFontFamily().run()),
|
|
78
|
-
},
|
|
79
|
-
attrs: {
|
|
80
|
-
click: () => editor.chain().focus().unsetFontFamily().run()
|
|
81
|
-
},
|
|
82
|
-
children: fonts.map((font) => {
|
|
83
|
-
return {
|
|
84
|
-
name: font.name,
|
|
85
|
-
tooltip: '',
|
|
86
|
-
icon: '',
|
|
87
|
-
enabled: true,
|
|
88
|
-
noI18n: true,
|
|
89
|
-
props: {
|
|
90
|
-
color: computed(() => editor.isActive('textStyle', {fontFamily: font.fontFamily}) ? 'primary' : ''),
|
|
91
|
-
style: `font-family: ${font.fontFamily};`
|
|
92
|
-
},
|
|
93
|
-
attrs: {
|
|
94
|
-
click: () => editor.chain().focus().setFontFamily(font.fontFamily).run()
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
},
|
|
99
|
-
fontSize: {
|
|
100
|
-
name: 'font-size',
|
|
101
|
-
tooltip: 'style.fontSize',
|
|
102
|
-
icon: mdi.mdiFormatSize,
|
|
103
|
-
modelValue: false,
|
|
104
|
-
enabled: true,
|
|
105
|
-
props: {
|
|
106
|
-
disabled: computed(() => !editor.can().chain().focus().unsetFontSize().run()),
|
|
107
|
-
},
|
|
108
|
-
attrs: {
|
|
109
|
-
click: () => editor.chain().focus().unsetFontSize().run()
|
|
110
|
-
},
|
|
111
|
-
children: fontSizes.map((fontSize) => {
|
|
112
|
-
return {
|
|
113
|
-
name: `${fontSize}${fontMeasure}`,
|
|
114
|
-
tooltip: '',
|
|
115
|
-
icon: '',
|
|
116
|
-
enabled: true,
|
|
117
|
-
noI18n: true,
|
|
118
|
-
props: {
|
|
119
|
-
color: computed(() => editor.isActive('textStyle', {fontSizes: fontSize}) ? 'primary' : ''),
|
|
120
|
-
},
|
|
121
|
-
attrs: {
|
|
122
|
-
click: () => editor.chain().focus().setFontSize(`${fontSize}${fontMeasure}`).run()
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
},
|
|
127
|
-
lineHeight: {
|
|
128
|
-
name: 'line-height',
|
|
129
|
-
tooltip: 'style.lineHeight',
|
|
130
|
-
icon: mdi.mdiFormatLineHeight,
|
|
131
|
-
modelValue: null,
|
|
132
|
-
enabled: true,
|
|
133
|
-
props: {
|
|
134
|
-
disabled: computed(() => !editor.can().chain().focus().unsetLineHeight().run()),
|
|
135
|
-
},
|
|
136
|
-
attrs: {
|
|
137
|
-
click: () => editor.chain().focus().unsetLineHeight().run()
|
|
138
|
-
},
|
|
139
|
-
children: lineHeights.map((lineHeight) => {
|
|
140
|
-
return {
|
|
141
|
-
name: lineHeight,
|
|
142
|
-
tooltip: '',
|
|
143
|
-
icon: '',
|
|
144
|
-
enabled: true,
|
|
145
|
-
noI18n: true,
|
|
146
|
-
props: {
|
|
147
|
-
color: computed(() => editor.isActive('textStyle', {lineHeights: lineHeight}) ? 'primary' : ''),
|
|
148
|
-
},
|
|
149
|
-
attrs: {
|
|
150
|
-
click: () => editor.chain().focus().setLineHeight(lineHeight.toString()).run()
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
},
|
|
155
|
-
highlight: {
|
|
156
|
-
name: 'highlight',
|
|
157
|
-
tooltip: 'style.color.highlight',
|
|
158
|
-
icon: mdi.mdiFormatColorFill,
|
|
159
|
-
icon2: mdi.mdiColorHelper,
|
|
160
|
-
enabled: true,
|
|
161
|
-
props: {
|
|
162
|
-
disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
|
|
163
|
-
},
|
|
164
|
-
icon2Props: {
|
|
165
|
-
disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
|
|
166
|
-
color: computed(() => {
|
|
167
|
-
const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
|
|
168
|
-
return editor.getAttributes('highlight').color || defaultColor
|
|
169
|
-
}),
|
|
170
|
-
style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
|
|
171
|
-
},
|
|
172
|
-
component: markRaw(StyleColor),
|
|
173
|
-
componentProps: {
|
|
174
|
-
fontColor: false,
|
|
175
|
-
backgroundColor: true,
|
|
176
|
-
color: computed(() => editor.getAttributes('highlight').color || ''),
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
color: {
|
|
180
|
-
name: 'color',
|
|
181
|
-
tooltip: 'style.color.text',
|
|
182
|
-
icon: mdi.mdiFormatColorText,
|
|
183
|
-
icon2: mdi.mdiColorHelper,
|
|
184
|
-
enabled: true,
|
|
185
|
-
props: {
|
|
186
|
-
disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
|
|
187
|
-
},
|
|
188
|
-
icon2Props: {
|
|
189
|
-
disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
|
|
190
|
-
color: computed(() => {
|
|
191
|
-
const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
|
|
192
|
-
return editor.getAttributes('textStyle').color || defaultColor
|
|
193
|
-
}),
|
|
194
|
-
style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
|
|
195
|
-
},
|
|
196
|
-
component: markRaw(StyleColor),
|
|
197
|
-
componentProps: {
|
|
198
|
-
fontColor: true,
|
|
199
|
-
backgroundColor: false,
|
|
200
|
-
color: computed(() => editor.getAttributes('textStyle').color || ''),
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
File without changes
|