tiptapify 0.0.11 → 0.0.13
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 +9 -4
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +47819 -28736
- package/dist/tiptapify.umd.js +78 -38
- package/index.d.ts +2 -2
- package/package.json +49 -45
- package/src/components/MenuBubble.vue +8 -8
- package/src/components/Tiptapify.vue +4 -5
- package/src/components/Toolbar/Group.vue +2 -2
- package/src/components/Toolbar/GroupBtn.vue +11 -8
- package/src/components/Toolbar/GroupDropdown.vue +3 -17
- package/src/components/Toolbar/Index.vue +13 -10
- package/src/components/Toolbar/Items.vue +3 -6
- package/src/components/Toolbar/Toggle.vue +2 -4
- package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
- package/src/components/Toolbar/items.ts +43 -60
- package/src/components/UI/BtnIcon.vue +24 -0
- package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
- package/src/components/editorExtensions.ts +16 -1
- 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/useEmoji.ts +20 -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 +5 -31
- package/src/composables/Toolbar/useAlignmentItems.ts +9 -59
- package/src/composables/Toolbar/useFormatExtraItems.ts +11 -72
- package/src/composables/Toolbar/useFormatItems.ts +9 -59
- package/src/composables/Toolbar/useListItems.ts +11 -69
- package/src/composables/Toolbar/useMediaItems.ts +9 -209
- package/src/composables/Toolbar/useMiscItems.ts +13 -58
- package/src/composables/Toolbar/useStyleItems.ts +14 -228
- package/src/extensions/components/Emoji.vue +109 -0
- package/src/extensions/components/ImageDialog.vue +7 -3
- package/src/extensions/components/LinkDialog.vue +7 -3
- package/src/extensions/components/PreviewDialog.vue +11 -4
- package/src/extensions/components/ShowSourceDialog.vue +7 -4
- package/src/extensions/components/StyleColor.vue +2 -2
- package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
- package/src/extensions/emoji/activities.ts +770 -0
- package/src/extensions/emoji/animals_and_nature.ts +1330 -0
- package/src/extensions/emoji/component.ts +74 -0
- package/src/extensions/emoji/flags.ts +2210 -0
- package/src/extensions/emoji/food_and_drink.ts +1066 -0
- package/src/extensions/emoji/index.ts +63 -0
- package/src/extensions/emoji/objects.ts +2514 -0
- package/src/extensions/emoji/people_and_body.ts +3986 -0
- package/src/extensions/emoji/smileys_and_emotion.ts +1482 -0
- package/src/extensions/emoji/symbols.ts +2242 -0
- package/src/extensions/emoji/travel_and_places.ts +2138 -0
- package/src/extensions/image.ts +2 -1
- package/src/extensions/link.ts +2 -1
- package/src/extensions/preview.ts +2 -1
- package/src/extensions/view-source.ts +2 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/locales/ch.json +14 -1
- package/src/i18n/locales/cz.json +14 -1
- package/src/i18n/locales/de.json +14 -1
- package/src/i18n/locales/en.json +14 -1
- package/src/i18n/locales/es.json +14 -1
- package/src/i18n/locales/fr.json +14 -1
- package/src/i18n/locales/it.json +14 -1
- package/src/i18n/locales/la.json +14 -1
- package/src/i18n/locales/lt.json +14 -1
- package/src/i18n/locales/nl.json +14 -1
- package/src/i18n/locales/pl.json +14 -1
- package/src/i18n/locales/pt.json +14 -1
- package/src/i18n/locales/ru.json +14 -1
- package/src/i18n/locales/se.json +14 -1
- package/src/i18n/locales/ua.json +14 -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/types/overridable-extensions.ts +0 -6
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
import { useI18n } from "vue-i18n";
|
|
7
|
+
|
|
8
|
+
interface MDIIcons {
|
|
9
|
+
[key: string]: string
|
|
10
|
+
}
|
|
11
|
+
const mdiIcons = mdi as MDIIcons
|
|
12
|
+
|
|
13
|
+
export function useHeading(customHeadingLevels: Array<number> = []) {
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
|
|
16
|
+
setHeadingLevels(customHeadingLevels)
|
|
17
|
+
|
|
18
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
name: 'heading',
|
|
22
|
+
tooltip: computed(() => t('style.heading')),
|
|
23
|
+
icon: `mdiSvg:${mdi.mdiFormatHeaderPound}`,
|
|
24
|
+
modelValue: null,
|
|
25
|
+
enabled: true,
|
|
26
|
+
props: {
|
|
27
|
+
color: computed(() => editor.value.isActive('heading') || editor.value.isActive('paragraph') ? 'primary' : ''),
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
name: 'paragraph',
|
|
32
|
+
tooltip: computed(() => t('style.paragraph')),
|
|
33
|
+
// icon: mdiIcons['mdiFormatParagraph'],
|
|
34
|
+
icon: `mdiSvg:${mdiIcons['mdiFormatParagraph']}`,
|
|
35
|
+
noI18n: true,
|
|
36
|
+
enabled: true,
|
|
37
|
+
props: {
|
|
38
|
+
color: computed(() => editor.value.isActive('paragraph') ? 'primary' : ''),
|
|
39
|
+
},
|
|
40
|
+
attrs: {
|
|
41
|
+
click: () => editor.value.chain().focus().setParagraph().run()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
].concat(
|
|
45
|
+
headingLevels.value.map(level => {
|
|
46
|
+
const headingLevel: Level = level as Level
|
|
47
|
+
return {
|
|
48
|
+
name: `H${level}`,
|
|
49
|
+
tooltip: computed(() => t(`style.headings.h${level}`)),
|
|
50
|
+
// icon: mdiIcons[`mdiFormatHeader${level}`],
|
|
51
|
+
icon: `mdiSvg:${mdiIcons[`mdiFormatHeader${level}`]}`,
|
|
52
|
+
noI18n: true,
|
|
53
|
+
enabled: true,
|
|
54
|
+
props: {
|
|
55
|
+
color: computed(() => editor.value.isActive('heading', {level: level}) ? 'primary' : ''),
|
|
56
|
+
},
|
|
57
|
+
attrs: {
|
|
58
|
+
click: () => editor.value.chain().focus().toggleHeading({level: headingLevel}).run()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import { useI18n } from "vue-i18n";
|
|
6
|
+
|
|
7
|
+
export function useHighlight(theme: any) {
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
|
|
10
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
name: 'highlight',
|
|
14
|
+
tooltip: computed(() => t('style.color.highlight')),
|
|
15
|
+
icon: `mdiSvg:${mdi.mdiFormatColorFill}`,
|
|
16
|
+
icon2: `mdiSvg:${mdi.mdiColorHelper}`,
|
|
17
|
+
enabled: true,
|
|
18
|
+
props: {
|
|
19
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
|
|
20
|
+
},
|
|
21
|
+
icon2Props: {
|
|
22
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
|
|
23
|
+
color: computed(() => {
|
|
24
|
+
const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
|
|
25
|
+
return editor.value.getAttributes('highlight').color || defaultColor
|
|
26
|
+
}),
|
|
27
|
+
style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
|
|
28
|
+
},
|
|
29
|
+
component: markRaw(StyleColor),
|
|
30
|
+
componentProps: {
|
|
31
|
+
fontColor: false,
|
|
32
|
+
backgroundColor: true,
|
|
33
|
+
color: computed(() => editor.value.getAttributes('highlight').color || ''),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { lineHeights } from "@tiptapify/constants/style";
|
|
4
|
+
import LineHeight from "@tiptapify/extensions/components/LineHeight.vue";
|
|
5
|
+
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
+
import { useI18n } from "vue-i18n";
|
|
7
|
+
|
|
8
|
+
export function useLineHeight() {
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
|
|
11
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
name: 'line-height',
|
|
15
|
+
tooltip: computed(() => t('style.lineHeight')),
|
|
16
|
+
icon: `mdiSvg:${mdi.mdiFormatLineHeight}`,
|
|
17
|
+
modelValue: null,
|
|
18
|
+
enabled: true,
|
|
19
|
+
props: {
|
|
20
|
+
disabled: computed(() => !editor.value.can().chain().focus().unsetLineHeight().run()),
|
|
21
|
+
color: computed(() => {
|
|
22
|
+
let color = ''
|
|
23
|
+
for (const height of lineHeights) {
|
|
24
|
+
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
25
|
+
color = 'primary'
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return color
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
component: markRaw(LineHeight),
|
|
34
|
+
componentProps: {
|
|
35
|
+
lineHeights,
|
|
36
|
+
lineHeight: computed(() => {
|
|
37
|
+
let lineHeight = null
|
|
38
|
+
for (const height of lineHeights) {
|
|
39
|
+
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
40
|
+
lineHeight = height
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return lineHeight
|
|
46
|
+
}),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { computed } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
|
-
|
|
6
|
-
export function useActionsItems(editor: Editor) {
|
|
7
|
-
const { t } = useI18n();
|
|
1
|
+
import { useRedo } from "@tiptapify/composables/Toolbar/Actions/useRedo";
|
|
2
|
+
import { useUndo } from "@tiptapify/composables/Toolbar/Actions/useUndo";
|
|
8
3
|
|
|
4
|
+
export function useActionsItems() {
|
|
9
5
|
return {
|
|
10
|
-
undo:
|
|
11
|
-
|
|
12
|
-
tooltip: computed(() => t('action.undo')),
|
|
13
|
-
icon: mdi.mdiUndo,
|
|
14
|
-
enabled: true,
|
|
15
|
-
props: {
|
|
16
|
-
disabled: computed(() => !editor.can().chain().focus().undo().run()),
|
|
17
|
-
},
|
|
18
|
-
attrs: {
|
|
19
|
-
click: () => editor.chain().focus().undo().run()
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
redo: {
|
|
23
|
-
name: 'redo',
|
|
24
|
-
tooltip: computed(() => t('action.redo')),
|
|
25
|
-
icon: mdi.mdiRedo,
|
|
26
|
-
enabled: true,
|
|
27
|
-
props: {
|
|
28
|
-
disabled: computed(() => !editor.can().chain().focus().redo().run()),
|
|
29
|
-
},
|
|
30
|
-
attrs: {
|
|
31
|
-
click: () => editor.chain().focus().redo().run()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
6
|
+
undo: useUndo(),
|
|
7
|
+
redo: useRedo()
|
|
34
8
|
}
|
|
35
9
|
}
|
|
@@ -1,63 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export function useAlignmentItems(editor: Editor) {
|
|
7
|
-
const { t } = useI18n();
|
|
1
|
+
import { useAlignmentCenter } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentCenter";
|
|
2
|
+
import { useAlignmentJustify } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentJustify";
|
|
3
|
+
import { useAlignmentLeft } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentLeft";
|
|
4
|
+
import { useAlignmentRight } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentRight";
|
|
8
5
|
|
|
6
|
+
export function useAlignmentItems() {
|
|
9
7
|
return {
|
|
10
|
-
alignmentLeft:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
enabled: true,
|
|
15
|
-
props: {
|
|
16
|
-
active: false,
|
|
17
|
-
color: computed(() => editor.isActive({ textAlign: 'left' }) ? 'primary' : ''),
|
|
18
|
-
},
|
|
19
|
-
attrs: {
|
|
20
|
-
click: () => editor.chain().focus().toggleTextAlign('left').run()
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
alignmentCenter: {
|
|
24
|
-
name: computed(() => t('alignments.center')),
|
|
25
|
-
tooltip: computed(() => t('alignments.center')),
|
|
26
|
-
icon: mdi.mdiFormatAlignCenter,
|
|
27
|
-
enabled: true,
|
|
28
|
-
props: {
|
|
29
|
-
active: false,
|
|
30
|
-
color: computed(() => editor.isActive({ textAlign: 'center' }) ? 'primary' : ''),
|
|
31
|
-
},
|
|
32
|
-
attrs: {
|
|
33
|
-
click: () => editor.chain().focus().toggleTextAlign('center').run()
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
alignmentRight: {
|
|
37
|
-
name: computed(() => t('alignments.right')),
|
|
38
|
-
tooltip: computed(() => t('alignments.right')),
|
|
39
|
-
icon: mdi.mdiFormatAlignRight,
|
|
40
|
-
enabled: true,
|
|
41
|
-
props: {
|
|
42
|
-
active: false,
|
|
43
|
-
color: computed(() => editor.isActive({ textAlign: 'right' }) ? 'primary' : ''),
|
|
44
|
-
},
|
|
45
|
-
attrs: {
|
|
46
|
-
click: () => editor.chain().focus().toggleTextAlign('right').run()
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
alignmentJustify: {
|
|
50
|
-
name: computed(() => t('alignments.justify')),
|
|
51
|
-
tooltip: computed(() => t('alignments.justify')),
|
|
52
|
-
icon: mdi.mdiFormatAlignJustify,
|
|
53
|
-
enabled: true,
|
|
54
|
-
props: {
|
|
55
|
-
active: false,
|
|
56
|
-
color: computed(() => editor.isActive({ textAlign: 'justify' }) ? 'primary' : ''),
|
|
57
|
-
},
|
|
58
|
-
attrs: {
|
|
59
|
-
click: () => editor.chain().focus().toggleTextAlign('justify').run()
|
|
60
|
-
}
|
|
61
|
-
},
|
|
8
|
+
alignmentLeft: useAlignmentLeft(),
|
|
9
|
+
alignmentCenter: useAlignmentCenter(),
|
|
10
|
+
alignmentRight: useAlignmentRight(),
|
|
11
|
+
alignmentJustify: useAlignmentJustify()
|
|
62
12
|
}
|
|
63
13
|
}
|
|
@@ -1,76 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export function useFormatExtraItems(editor: Editor) {
|
|
7
|
-
const { t } = useI18n();
|
|
1
|
+
import { useBlockquote } from "@tiptapify/composables/Toolbar/FormatExtra/useBlockquote";
|
|
2
|
+
import { useCode } from "@tiptapify/composables/Toolbar/FormatExtra/useCode";
|
|
3
|
+
import { useCodeBlock } from "@tiptapify/composables/Toolbar/FormatExtra/useCodeBlock";
|
|
4
|
+
import { useSub } from "@tiptapify/composables/Toolbar/FormatExtra/useSub";
|
|
5
|
+
import { useSup } from "@tiptapify/composables/Toolbar/FormatExtra/useSup";
|
|
8
6
|
|
|
7
|
+
export function useFormatExtraItems() {
|
|
9
8
|
return {
|
|
10
|
-
sup:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
props: {
|
|
16
|
-
disabled: computed(() => !editor.can().chain().focus().toggleSuperscript().run()),
|
|
17
|
-
color: computed(() => editor.isActive('superscript') ? 'primary' : ''),
|
|
18
|
-
},
|
|
19
|
-
attrs: {
|
|
20
|
-
click: () => editor.chain().focus().toggleSuperscript().run()
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
sub: {
|
|
24
|
-
name: 'sub',
|
|
25
|
-
tooltip: computed(() => t('format.sub')),
|
|
26
|
-
icon: mdi.mdiFormatSubscript,
|
|
27
|
-
enabled: true,
|
|
28
|
-
props: {
|
|
29
|
-
disabled: computed(() => !editor.can().chain().focus().toggleSubscript().run()),
|
|
30
|
-
color: computed(() => editor.isActive('subscript') ? 'primary' : ''),
|
|
31
|
-
},
|
|
32
|
-
attrs: {
|
|
33
|
-
click: () => editor.chain().focus().toggleSubscript().run()
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
code: {
|
|
37
|
-
name: 'code',
|
|
38
|
-
tooltip: computed(() => t('format.code')),
|
|
39
|
-
icon: mdi.mdiXml,
|
|
40
|
-
enabled: true,
|
|
41
|
-
props: {
|
|
42
|
-
disabled: computed(() => !editor.can().chain().focus().toggleCode().run()),
|
|
43
|
-
color: computed(() => editor.isActive('code') ? 'primary' : ''),
|
|
44
|
-
},
|
|
45
|
-
attrs: {
|
|
46
|
-
click: () => editor.chain().focus().toggleCode().run()
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
codeBlock: {
|
|
50
|
-
name: 'codeblock',
|
|
51
|
-
tooltip: computed(() => t('format.codeblock')),
|
|
52
|
-
icon: mdi.mdiCodeBlockTags,
|
|
53
|
-
enabled: true,
|
|
54
|
-
props: {
|
|
55
|
-
disabled: computed(() => !editor.can().chain().focus().toggleCodeBlock().run()),
|
|
56
|
-
color: computed(() => editor.isActive('codeBlock') ? 'primary' : ''),
|
|
57
|
-
},
|
|
58
|
-
attrs: {
|
|
59
|
-
click: () => editor.chain().focus().toggleCodeBlock().run()
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
blockquote: {
|
|
63
|
-
name: 'blockquote',
|
|
64
|
-
tooltip: computed(() => t('format.blockquote')),
|
|
65
|
-
icon: mdi.mdiCommentQuote,
|
|
66
|
-
enabled: true,
|
|
67
|
-
props: {
|
|
68
|
-
disabled: computed(() => !editor.can().chain().focus().toggleBlockquote().run() || editor.isActive('codeBlock') || editor.isActive('code')),
|
|
69
|
-
color: computed(() => editor.isActive('blockquote') ? 'primary' : ''),
|
|
70
|
-
},
|
|
71
|
-
attrs: {
|
|
72
|
-
click: () => editor.chain().focus().toggleBlockquote().run()
|
|
73
|
-
}
|
|
74
|
-
}
|
|
9
|
+
sup: useSup(),
|
|
10
|
+
sub: useSub(),
|
|
11
|
+
code: useCode(),
|
|
12
|
+
codeBlock: useCodeBlock(),
|
|
13
|
+
blockquote: useBlockquote()
|
|
75
14
|
}
|
|
76
15
|
}
|
|
@@ -1,63 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export function useFormatItems(editor: Editor) {
|
|
7
|
-
const { t } = useI18n();
|
|
1
|
+
import { useBold } from "@tiptapify/composables/Toolbar/Format/useBold";
|
|
2
|
+
import { useItalic } from "@tiptapify/composables/Toolbar/Format/useItalic";
|
|
3
|
+
import { useStrike } from "@tiptapify/composables/Toolbar/Format/useStrike";
|
|
4
|
+
import { useUnderline } from "@tiptapify/composables/Toolbar/Format/useUnderline";
|
|
8
5
|
|
|
6
|
+
export function useFormatItems() {
|
|
9
7
|
return {
|
|
10
|
-
bold:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
enabled: true,
|
|
15
|
-
props: {
|
|
16
|
-
disabled: computed(() => !editor.can().chain().focus().toggleBold().run()),
|
|
17
|
-
color: computed(() => editor.isActive('bold') ? 'primary' : ''),
|
|
18
|
-
},
|
|
19
|
-
attrs: {
|
|
20
|
-
click: () => editor.chain().focus().toggleBold().run()
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
italic: {
|
|
24
|
-
name: 'italic',
|
|
25
|
-
tooltip: computed(() => t('format.italic')),
|
|
26
|
-
icon: mdi.mdiFormatItalic,
|
|
27
|
-
enabled: true,
|
|
28
|
-
props: {
|
|
29
|
-
disabled: computed(() => !editor.can().chain().focus().toggleItalic().run()),
|
|
30
|
-
color: computed(() => editor.isActive('italic') ? 'primary' : ''),
|
|
31
|
-
},
|
|
32
|
-
attrs: {
|
|
33
|
-
click: () => editor.chain().focus().toggleItalic().run()
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
underline: {
|
|
37
|
-
name: 'underline',
|
|
38
|
-
tooltip: computed(() => t('format.underline')),
|
|
39
|
-
icon: mdi.mdiFormatUnderline,
|
|
40
|
-
enabled: true,
|
|
41
|
-
props: {
|
|
42
|
-
disabled: computed(() => !editor.can().chain().focus().toggleUnderline().run()),
|
|
43
|
-
color: computed(() => editor.isActive('underline') ? 'primary' : ''),
|
|
44
|
-
},
|
|
45
|
-
attrs: {
|
|
46
|
-
click: () => editor.chain().focus().toggleUnderline().run()
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
strike: {
|
|
50
|
-
name: 'strike',
|
|
51
|
-
tooltip: computed(() => t('format.strike')),
|
|
52
|
-
icon: mdi.mdiFormatStrikethroughVariant,
|
|
53
|
-
enabled: true,
|
|
54
|
-
props: {
|
|
55
|
-
disabled: computed(() => !editor.can().chain().focus().toggleStrike().run()),
|
|
56
|
-
color: computed(() => editor.isActive('strike') ? 'primary' : ''),
|
|
57
|
-
},
|
|
58
|
-
attrs: {
|
|
59
|
-
click: () => editor.chain().focus().toggleStrike().run()
|
|
60
|
-
}
|
|
61
|
-
}
|
|
8
|
+
bold: useBold(),
|
|
9
|
+
italic: useItalic(),
|
|
10
|
+
underline: useUnderline(),
|
|
11
|
+
strike: useStrike()
|
|
62
12
|
}
|
|
63
13
|
}
|
|
@@ -1,73 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export function useListItems(editor: Editor) {
|
|
7
|
-
const { t } = useI18n();
|
|
1
|
+
import { useBullet } from "@tiptapify/composables/Toolbar/List/useBullet";
|
|
2
|
+
import { useIndent } from "@tiptapify/composables/Toolbar/List/useIndent";
|
|
3
|
+
import { useNumbered } from "@tiptapify/composables/Toolbar/List/useNumbered";
|
|
4
|
+
import { useOutdent } from "@tiptapify/composables/Toolbar/List/useOutdent";
|
|
5
|
+
import { useTask } from "@tiptapify/composables/Toolbar/List/useTask";
|
|
8
6
|
|
|
7
|
+
export function useListItems() {
|
|
9
8
|
return {
|
|
10
|
-
listBullet:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
props: {
|
|
16
|
-
color: computed(() => editor.isActive('bulletList') ? 'primary' : ''),
|
|
17
|
-
},
|
|
18
|
-
attrs: {
|
|
19
|
-
click: () => editor.chain().focus().toggleBulletList().run()
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
listNumbered: {
|
|
23
|
-
name: computed(() => t('lists.numbered')),
|
|
24
|
-
tooltip: computed(() => t('lists.numbered')),
|
|
25
|
-
icon: mdi.mdiFormatListNumbered,
|
|
26
|
-
enabled: true,
|
|
27
|
-
props: {
|
|
28
|
-
color: computed(() => editor.isActive('orderedList') ? 'primary' : ''),
|
|
29
|
-
},
|
|
30
|
-
attrs: {
|
|
31
|
-
click: () => editor.chain().focus().toggleOrderedList().run()
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
listTask: {
|
|
35
|
-
name: computed(() => t('lists.task')),
|
|
36
|
-
tooltip: computed(() => t('lists.task')),
|
|
37
|
-
icon: mdi.mdiFormatListChecks,
|
|
38
|
-
enabled: true,
|
|
39
|
-
props: {
|
|
40
|
-
color: computed(() => editor.isActive('taskList') ? 'primary' : ''),
|
|
41
|
-
},
|
|
42
|
-
attrs: {
|
|
43
|
-
click: () => editor.chain().focus().toggleTaskList().run()
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
listIndent: {
|
|
47
|
-
name: computed(() => t('lists.indent')),
|
|
48
|
-
tooltip: computed(() => t('lists.indent')),
|
|
49
|
-
icon: mdi.mdiFormatIndentIncrease,
|
|
50
|
-
enabled: true,
|
|
51
|
-
props: {
|
|
52
|
-
disabled: computed(() => !editor.can().sinkListItem('listItem')),
|
|
53
|
-
active: false,
|
|
54
|
-
},
|
|
55
|
-
attrs: {
|
|
56
|
-
click: () => editor.chain().focus().sinkListItem('listItem').run()
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
listOutdent: {
|
|
60
|
-
name: computed(() => t('lists.outdent')),
|
|
61
|
-
tooltip: computed(() => t('lists.outdent')),
|
|
62
|
-
icon: mdi.mdiFormatIndentDecrease,
|
|
63
|
-
enabled: true,
|
|
64
|
-
props: {
|
|
65
|
-
disabled: computed(() => !editor.can().liftListItem('listItem')),
|
|
66
|
-
active: false,
|
|
67
|
-
},
|
|
68
|
-
attrs: {
|
|
69
|
-
click: () => editor.chain().focus().liftListItem('listItem').run()
|
|
70
|
-
}
|
|
71
|
-
}
|
|
9
|
+
listBullet: useBullet(),
|
|
10
|
+
listNumbered: useNumbered(),
|
|
11
|
+
listTask: useTask(),
|
|
12
|
+
listIndent: useIndent(),
|
|
13
|
+
listOutdent: useOutdent()
|
|
72
14
|
}
|
|
73
15
|
}
|