tiptapify 0.0.5 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiptapify",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
5
5
  "exports": {
6
6
  ".": {
@@ -7,6 +7,7 @@ import * as mdi from '@mdi/js'
7
7
 
8
8
  defineProps({
9
9
  variant: { type: String, default () { return 'flat' }},
10
+ theme: { type: String, default () { return 'light' }},
10
11
  })
11
12
 
12
13
  const { editor } = useEditor()
@@ -19,7 +20,6 @@ const items = ref([
19
20
  name: 'bold',
20
21
  icon: mdi.mdiFormatBold,
21
22
  props: {
22
- active: false,
23
23
  disabled: computed(() => !editorInstance.value.can().chain().focus().toggleBold().run()),
24
24
  color: computed(() => editorInstance.value.isActive('bold') ? 'primary' : ''),
25
25
  },
@@ -29,7 +29,6 @@ const items = ref([
29
29
  name: 'italic',
30
30
  icon: mdi.mdiFormatItalic,
31
31
  props: {
32
- active: false,
33
32
  disabled: computed(() => !editorInstance.value.can().chain().focus().toggleItalic().run()),
34
33
  color: computed(() => editorInstance.value.isActive('italic') ? 'primary' : ''),
35
34
  },
@@ -39,7 +38,6 @@ const items = ref([
39
38
  name: 'strike',
40
39
  icon: mdi.mdiFormatStrikethroughVariant,
41
40
  props: {
42
- active: false,
43
41
  disabled: computed(() => !editorInstance.value.can().chain().focus().toggleStrike().run()),
44
42
  color: computed(() => editorInstance.value.isActive('strike') ? 'primary' : ''),
45
43
  },
@@ -49,7 +47,6 @@ const items = ref([
49
47
  name: 'underline',
50
48
  icon: mdi.mdiFormatUnderline,
51
49
  props: {
52
- active: false,
53
50
  disabled: computed(() => !editorInstance.value.can().chain().focus().toggleUnderline().run()),
54
51
  color: computed(() => editorInstance.value.isActive('underline') ? 'primary' : ''),
55
52
  },
@@ -59,17 +56,24 @@ const items = ref([
59
56
  name: 'highlight',
60
57
  icon: mdi.mdiFormatColorHighlight,
61
58
  props: {
62
- active: false,
63
59
  disabled: computed(() => !editorInstance.value.can().chain().focus().toggleHighlight().run()),
64
60
  color: computed(() => editorInstance.value.isActive('highlight') ? 'primary' : ''),
65
61
  },
66
62
  click: () => editorInstance.value.chain().focus().toggleHighlight().run(),
67
63
  },
64
+ {
65
+ name: 'code',
66
+ icon: mdi.mdiXml,
67
+ props: {
68
+ disabled: computed(() => !editorInstance.value.can().chain().focus().toggleCode().run()),
69
+ color: computed(() => editorInstance.value.isActive('code') ? 'primary' : ''),
70
+ },
71
+ click: () => editorInstance.value.chain().focus().toggleCode().run(),
72
+ },
68
73
  {
69
74
  name: 'link',
70
75
  icon: computed(() => editorInstance.value.isActive('link') ? mdi.mdiLinkOff : mdi.mdiLink),
71
76
  props: {
72
- active: false,
73
77
  color: computed(() => editorInstance.value.isActive('link') ? 'primary' : ''),
74
78
  disabled: computed(() => editorInstance.value.isActive('code') || editorInstance.value.isActive('codeBlock')),
75
79
  },
@@ -78,9 +82,6 @@ const items = ref([
78
82
  {
79
83
  name: 'format clear',
80
84
  icon: mdi.mdiFormatClear,
81
- props: {
82
- active: false,
83
- },
84
85
  click: () => editorInstance.value.chain().focus().unsetAllMarks().clearNodes().run(),
85
86
  }
86
87
  ])
@@ -93,14 +94,21 @@ function linkAction() {
93
94
  </script>
94
95
 
95
96
  <template>
96
- <!-- <BubbleMenu v-if="editorInstance" :editor="editorInstance" :tippy-options="{ duration: 100 }">-->
97
97
  <BubbleMenu v-if="editorInstance" :editor="editorInstance" :options="{ placement: 'bottom' }">
98
98
  <div class="bubble-menu">
99
- <VBtnToggle divided density="compact" :variant="variant">
100
- <VBtn v-for="(item, key) in items" :key="key" v-bind="item.props" @click="item.click" size="small">
101
- <VIcon :icon="item.icon" size="16" />
102
- </VBtn>
103
- </VBtnToggle>
99
+ <VCard>
100
+ <VCardText class="pa-0">
101
+ <VToolbar :theme="theme" density="compact" height="auto" class="p-0">
102
+ <VToolbarItems>
103
+ <VBtnGroup divided density="compact">
104
+ <VBtn v-for="(item, key) in items" :key="key" v-bind="item.props" @click="item.click" size="x-small">
105
+ <VIcon :icon="item.icon" size="20" />
106
+ </VBtn>
107
+ </VBtnGroup>
108
+ </VToolbarItems>
109
+ </VToolbar>
110
+ </VCardText>
111
+ </VCard>
104
112
  </div>
105
113
  </BubbleMenu>
106
114
 
@@ -109,10 +117,7 @@ function linkAction() {
109
117
 
110
118
  <style scoped lang="scss">
111
119
  .bubble-menu {
112
- border-radius: 4px;
113
- border-color: var(--gray-3);
114
- border-style: solid;
115
- border-width: 1px;
116
- box-shadow: var(--shadow);
120
+ border-radius: 6px;
121
+ box-shadow: 4px 4px 20px var(--dark-gray);
117
122
  }
118
123
  </style>
@@ -6,49 +6,53 @@ import * as mdi from '@mdi/js'
6
6
 
7
7
  defineProps({
8
8
  variant: { type: String, default () { return '' }},
9
+ theme: { type: String, default () { return 'light' }},
9
10
  })
10
11
 
11
- const { editor } = useEditor()
12
- const editorInstance = ref(editor.getInstance())
12
+ const editorInstance = ref(useEditor().editor.getInstance())
13
13
  </script>
14
14
 
15
15
  <template>
16
- <!-- <FloatingMenu v-if="editorInstance" :editor="editorInstance" :tippy-options="{ duration: 100 }" >-->
17
16
  <FloatingMenu v-if="editorInstance" :editor="editorInstance">
18
17
  <div class="floating-menu">
19
- <VBtnToggle divided density="compact" :variant="`${variant || 'plain'}`">
20
- <VBtn
21
- @click="editorInstance.chain().focus().toggleHeading({ level: 1 }).run()"
22
- :color="`${editorInstance.isActive('heading', { level: 1 }) ? 'primary' : ''}`"
23
- size="small"
24
- >
25
- <VIcon :icon="mdi['mdiFormatHeader1']" size="16" />
26
- </VBtn>
27
- <VBtn
28
- @click="editorInstance.chain().focus().toggleHeading({ level: 2 }).run()"
29
- :color="`${editorInstance.isActive('heading', { level: 2 }) ? 'primary' : ''}`"
30
- size="small"
31
- >
32
- <VIcon :icon="mdi['mdiFormatHeader2']" size="16" />
33
- </VBtn>
34
- <VBtn
35
- @click="editorInstance.chain().focus().toggleBulletList().run()"
36
- :color="`${editorInstance.isActive('bulletList') ? 'primary' : ''}`"
37
- size="small"
38
- >
39
- <VIcon :icon="mdi['mdiFormatListBulleted']" size="16" />
40
- </VBtn>
41
- </VBtnToggle>
18
+ <VCard>
19
+ <VCardText class="pa-0">
20
+ <VToolbar :theme="theme" density="compact" height="auto" class="p-0">
21
+ <VToolbarItems>
22
+ <VBtnGroup divided density="compact">
23
+ <VBtn
24
+ @click="editorInstance.chain().focus().toggleHeading({ level: 1 }).run()"
25
+ :color="`${editorInstance.isActive('heading', { level: 1 }) ? 'primary' : ''}`"
26
+ size="small"
27
+ >
28
+ <VIcon :icon="mdi['mdiFormatHeader1']" size="16" />
29
+ </VBtn>
30
+ <VBtn
31
+ @click="editorInstance.chain().focus().toggleHeading({ level: 2 }).run()"
32
+ :color="`${editorInstance.isActive('heading', { level: 2 }) ? 'primary' : ''}`"
33
+ size="small"
34
+ >
35
+ <VIcon :icon="mdi['mdiFormatHeader2']" size="16" />
36
+ </VBtn>
37
+ <VBtn
38
+ @click="editorInstance.chain().focus().toggleBulletList().run()"
39
+ :color="`${editorInstance.isActive('bulletList') ? 'primary' : ''}`"
40
+ size="small"
41
+ >
42
+ <VIcon :icon="mdi['mdiFormatListBulleted']" size="16" />
43
+ </VBtn>
44
+ </VBtnGroup>
45
+ </VToolbarItems>
46
+ </VToolbar>
47
+ </VCardText>
48
+ </VCard>
42
49
  </div>
43
50
  </FloatingMenu>
44
51
  </template>
45
52
 
46
53
  <style scoped lang="scss">
47
54
  .floating-menu {
48
- border-radius: 4px;
49
- border-color: var(--gray-3);
50
- border-style: solid;
51
- border-width: 1px;
52
- box-shadow: var(--shadow);
55
+ border-radius: 6px;
56
+ box-shadow: 4px 4px 20px var(--dark-gray);
53
57
  }
54
58
  </style>
@@ -8,10 +8,11 @@ import MenuBubble from '@tiptapify/components/MenuBubble.vue'
8
8
  import MenuFloating from '@tiptapify/components/MenuFloating.vue'
9
9
 
10
10
  import Footer from '@tiptapify/components/Footer.vue'
11
+ import { useTheme } from "vuetify/framework";
11
12
 
12
13
  const props = defineProps({
13
14
  content: String|Object,
14
- variant: { type: String, default () { return 'flat' } },
15
+ variant: { type: String, default () { return 'elevated' } },
15
16
  toolbar: { type: Boolean, default () { return true } },
16
17
  items: { type: Array<string>, default() { return [] }},
17
18
  itemsExclude: { type: Boolean, default() { return false } },
@@ -22,8 +23,11 @@ const props = defineProps({
22
23
  showCharacterCount: { type: Boolean, default () { return true } },
23
24
  defaultFontFamily: { type: String, default () { return 'Inter' } },
24
25
  fontMeasure: { type: String, default () { return 'px' } },
26
+ rounded: { type: String, default () { return '0' } },
25
27
  })
26
28
 
29
+ const theme = ref(useTheme().current.value.dark ? 'dark' : 'light')
30
+
27
31
  const editor = useEditor(props.content, props.placeholder, props.slashCommands).editor
28
32
  const editorInstance = ref(editor.getInstance())
29
33
  editorInstance?.value?.chain().setFontFamily(props.defaultFontFamily).run()
@@ -38,21 +42,22 @@ onBeforeUnmount(() => {
38
42
  <VContainer>
39
43
  <VRow>
40
44
  <VCol>
41
- <div class="border rounded">
42
- <template v-if="toolbar">
43
- <Toolbar
44
- v-if="editorInstance"
45
- :variant="variant"
46
- :font-measure="fontMeasure"
47
- :items="items"
48
- :items-exclude="itemsExclude"
49
- />
50
- </template>
51
-
45
+ <template v-if="toolbar">
46
+ <Toolbar
47
+ v-if="editorInstance"
48
+ :variant="variant"
49
+ :font-measure="fontMeasure"
50
+ :items="items"
51
+ :items-exclude="itemsExclude"
52
+ :rounded="rounded"
53
+ />
54
+ </template>
55
+
56
+ <div :class="`border border-t-0 rounded-b-${rounded}`">
52
57
  <div class="pa-2 tiptapify-container">
53
- <MenuFloating v-if="floatingMenu" />
58
+ <MenuFloating v-if="floatingMenu" :variant="variant" :theme="theme" />
54
59
 
55
- <MenuBubble v-if="bubbleMenu" />
60
+ <MenuBubble v-if="bubbleMenu" :variant="variant" :theme="theme" />
56
61
 
57
62
  <EditorContent :editor="editorInstance" class="tiptapify-editor" />
58
63
  </div>
@@ -77,6 +82,8 @@ onBeforeUnmount(() => {
77
82
  --white: #FFF;
78
83
  --black: #2E2B29;
79
84
  --black-contrast: #110F0E;
85
+ --dark-gray: rgb(98, 98, 98);
86
+ --gray: rgb(223 223 223);
80
87
  --gray-1: rgba(61, 37, 20, .05);
81
88
  --gray-2: rgba(61, 37, 20, .08);
82
89
  --gray-3: rgba(61, 37, 20, .12);
@@ -135,6 +142,36 @@ onBeforeUnmount(() => {
135
142
  }
136
143
  }
137
144
 
145
+ /* Task list specific styles */
146
+ ul[data-type='taskList'] {
147
+ list-style: none;
148
+ margin-left: 0;
149
+ padding: 0;
150
+
151
+ li {
152
+ align-items: flex-start;
153
+ display: flex;
154
+
155
+ > label {
156
+ flex: 0 0 auto;
157
+ margin-right: 0.5rem;
158
+ user-select: none;
159
+ }
160
+
161
+ > div {
162
+ flex: 1 1 auto;
163
+ }
164
+ }
165
+
166
+ input[type='checkbox'] {
167
+ cursor: pointer;
168
+ }
169
+
170
+ ul[data-type='taskList'] {
171
+ margin: 0;
172
+ }
173
+ }
174
+
138
175
  /* Heading styles */
139
176
  h1,
140
177
  h2,
@@ -0,0 +1,78 @@
1
+ <script setup lang="ts">
2
+ import { defineProps, PropType } from 'vue'
3
+ import { useI18n } from "vue-i18n";
4
+
5
+ import { ToolbarItemSection } from "@tiptapify/components/Toolbar/items";
6
+
7
+ defineProps({
8
+ variant: { type: String, default () { return 'flat' }},
9
+ section: { type: String, default() { return '' }},
10
+ toolbarSection: { type: Object as PropType<ToolbarItemSection>, default() { return {} }}
11
+ })
12
+
13
+ const { t } = useI18n();
14
+
15
+ </script>
16
+
17
+ <template>
18
+ <VBtnGroup :variant="variant" elevation="4">
19
+ <template v-for="(toolbarItem, toolbarItemKey) in toolbarSection.items" :key="toolbarItemKey">
20
+ <template v-if="toolbarItem.children">
21
+ <VMenu>
22
+ <template #activator="{ props: menuProps }">
23
+ <VBtn v-bind="{ ...menuProps, ...toolbarItem.props }" size="32">
24
+ <VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
25
+
26
+ <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
27
+ <span v-else class="menu-item-title">
28
+ {{ t(toolbarItem.name) }}
29
+ </span>
30
+ </VBtn>
31
+ </template>
32
+
33
+ <VList v-model="toolbarItem.modelValue" max-height="430px">
34
+ <VListItem
35
+ v-for="(item, menuItemKey) in toolbarItem.children"
36
+ :key="menuItemKey"
37
+ :value="item.name"
38
+ density="compact"
39
+ class="pa-0"
40
+ >
41
+ <VBtn
42
+ variant="flat"
43
+ rounded="0"
44
+ v-bind="item.props"
45
+ v-on="item.attrs"
46
+ >
47
+ <VTooltip v-if="item.tooltip" :text="t(item.tooltip)" location="top" activator="parent" />
48
+
49
+ <VIcon v-if="item.icon" :icon="item.icon" size="small" />
50
+ <span v-else class="menu-item-title">
51
+ <template v-if="item.noI18n">
52
+ {{ item.name }}
53
+ </template>
54
+ <template v-else>
55
+ {{ t(item.toggle) }}
56
+ </template>
57
+ </span>
58
+ </VBtn>
59
+ </VListItem>
60
+ </VList>
61
+ </VMenu>
62
+ </template>
63
+
64
+ <VBtn v-else v-bind="toolbarItem.props" v-on="toolbarItem.attrs" size="32">
65
+ <VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
66
+
67
+ <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
68
+ <span v-else class="menu-item-title">
69
+ {{ t(toolbarItem.name) }}
70
+ </span>
71
+ </VBtn>
72
+ </template>
73
+ </VBtnGroup>
74
+ </template>
75
+
76
+ <style lang="scss" scoped>
77
+
78
+ </style>
@@ -1,6 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import LinkDialog from "@tiptapify/components/extensions/components/LinkDialog.vue";
3
3
  import ShowSource from "@tiptapify/components/extensions/components/ShowSource.vue";
4
+ import Group from "@tiptapify/components/Toolbar/Group.vue";
5
+ import Toggle from "@tiptapify/components/Toolbar/Toggle.vue";
4
6
  import { useEditor } from "@tiptapify/composable/useEditor";
5
7
  import { computed, defineProps, Ref, ref } from 'vue'
6
8
  import { useI18n } from "vue-i18n";
@@ -15,6 +17,8 @@ const props = defineProps({
15
17
  fontMeasure: { type: String, default () { return 'px' }},
16
18
  customFonts: { type: Array<string>, default () { return [] } },
17
19
  customFontsOverride: { type: Boolean, default() { return false } },
20
+ theme: { type: String, default() { return 'light' } },
21
+ rounded: { type: String, default() { return '0' } },
18
22
  })
19
23
 
20
24
  const { t } = useI18n();
@@ -36,80 +40,38 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
36
40
  </script>
37
41
 
38
42
  <template>
39
- <div v-if="editor" class="d-flex flex-wrap gap-x-4 gap-y-2 tiptapify-menu">
40
- <template v-for="(toolbarItems, sectionKey) in toolbarItemsRef" :key="sectionKey">
41
- <template v-for="(toolbarItem, toolbarItemKey) in toolbarItems" :key="toolbarItemKey">
42
- <VDivider v-if="toolbarItem.name === '|'" vertical class="menu-divider" />
43
-
44
- <template v-else-if="toolbarItem.enabled">
45
- <template v-if="toolbarItem.children">
46
- <VBtnToggle v-if="toolbarItem.group" :variant="variant">
47
- <VBtn
48
- v-for="(item, key) of toolbarItem.children"
49
- v-bind="{ ...props, ...item.props}" v-on="item.attrs" size="32"
50
- :key="`${item.name}-${key}`"
51
- >
52
- <VTooltip :text="t(item.name)" location="top" activator="parent" />
53
-
54
- <VIcon v-if="item.icon" :icon="item.icon" size="small" />
55
- <span v-else class="menu-item-title">
56
- {{ t(toolbarItem.name) }}
57
- </span>
58
- </VBtn>
59
- </VBtnToggle>
60
-
61
- <VMenu v-else>
62
- <template #activator="{ props: menuProps }">
63
- <VBtn :variant="variant" v-bind="menuProps" size="32" class="menu-button">
64
- <VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
65
-
66
- <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
67
- <span v-else class="menu-item-title">
68
- {{ t(toolbarItem.name) }}
69
- </span>
70
- </VBtn>
71
- </template>
72
-
73
- <VList v-model="toolbarItem.modelValue" max-height="430px">
74
- <VListItem
75
- v-for="(item, menuItemKey) in toolbarItem.children"
76
- :key="menuItemKey"
77
- :value="item.name"
78
- density="compact"
79
- v-bind="item.props"
80
- v-on="item.attrs"
81
- >
82
- <VTooltip v-if="item.tooltip" :text="t(item.tooltip)" location="top" activator="parent" />
83
-
84
- <VListItemTitle>
85
- <VIcon v-if="item.icon" :icon="item.icon" size="small" />
86
- <span v-else class="menu-item-title">
87
- <template v-if="item.noI18n">
88
- {{ item.name }}
89
- </template>
90
- <template v-else>
91
- {{ t(item.name) }}
92
- </template>
93
- </span>
94
- </VListItemTitle>
95
- </VListItem>
96
- </VList>
97
- </VMenu>
98
- </template>
99
-
100
- <VBtn v-else :variant="variant" v-bind="toolbarItem.props" v-on="toolbarItem.attrs" class="menu-button" size="32">
43
+ <div v-if="editor">
44
+ <VToolbar elevation="1" :theme="theme" height="auto" :class="`ps-1 rounded-t-${rounded}`">
45
+ <VToolbarItems class="py-2">
46
+ <template v-for="(toolbarSection, sectionKey) in toolbarItemsRef" :key="sectionKey">
47
+ <Group v-if="toolbarSection.group" :variant="variant" :toolbar-section="toolbarSection" />
48
+
49
+ <Toggle v-else-if="toolbarSection.toggle" :variant="variant" :toolbar-section="toolbarSection" />
50
+
51
+ <VBtn
52
+ v-else
53
+ v-for="(toolbarItem, itemKey) in toolbarSection.items"
54
+ :key="itemKey"
55
+ :variant="variant"
56
+ v-bind="toolbarItem.props"
57
+ v-on="toolbarItem.attrs"
58
+ class="menu-button"
59
+ size="32"
60
+ elevation="4"
61
+ rounded="sm"
62
+ >
101
63
  <VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
102
64
 
103
65
  <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="16" />
104
66
  <span v-else class="menu-item-title">
105
- {{ t(toolbarItem.name) }}
106
- </span>
67
+ {{ t(toolbarItem.name) }}
68
+ </span>
107
69
  </VBtn>
108
- </template>
109
- </template>
110
70
 
111
- <VDivider vertical class="menu-divider" />
112
- </template>
71
+ <div class="menu-divider"></div>
72
+ </template>
73
+ </VToolbarItems>
74
+ </VToolbar>
113
75
 
114
76
  <LinkDialog ref="toolbarLinkButton" />
115
77
  <ShowSource />
@@ -122,6 +84,10 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
122
84
  border-bottom: var(--border);
123
85
  }
124
86
 
87
+ :deep(.toolbar__items) {
88
+ flex-wrap: wrap;
89
+ }
90
+
125
91
  :deep(.v-btn-group) {
126
92
  height: 32px !important;
127
93
  }
@@ -134,11 +100,16 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
134
100
  margin: 0 1px;
135
101
  }
136
102
 
137
- .v-divider.menu-divider {
138
- margin: 0 10px;
103
+ .menu-divider {
104
+ margin: 0 4px;
139
105
  }
140
106
 
141
- .v-divider.menu-divider:nth-last-child(1) {
107
+ .menu-divider:nth-last-child(1) {
142
108
  display: none;
143
109
  }
110
+
111
+ .v-toolbar-items {
112
+ flex-wrap: wrap;
113
+ row-gap: 5px;
114
+ }
144
115
  </style>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ import { defineProps, PropType } from 'vue'
3
+ import { useI18n } from "vue-i18n";
4
+
5
+ import { ToolbarItemSection } from "@tiptapify/components/Toolbar/items";
6
+
7
+ defineProps({
8
+ variant: { type: String, default () { return 'flat' }},
9
+ toolbarSection: { type: Object as PropType<ToolbarItemSection>, default() { return {} }}
10
+ })
11
+
12
+ const { t } = useI18n();
13
+
14
+ </script>
15
+
16
+ <template>
17
+ <VBtnToggle :variant="variant" elevation="4">
18
+ <template v-for="(item, key) in toolbarSection.items" :key="key">
19
+ <VBtn v-bind="item.props" v-on="item.attrs" size="32">
20
+ <VTooltip :text="t(item.name)" location="top" activator="parent" />
21
+
22
+ <VIcon v-if="item.icon" :icon="item.icon" size="small" />
23
+ <span v-else class="menu-item-title">
24
+ {{ t(item.name) }}
25
+ </span>
26
+ </VBtn>
27
+ </template>
28
+ </VBtnToggle>
29
+ </template>
30
+
31
+ <style lang="scss" scoped>
32
+
33
+ </style>
@@ -0,0 +1,32 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed } from "vue";
4
+
5
+ export function getActionsItems(editor: Editor) {
6
+ return {
7
+ undo: {
8
+ name: 'undo',
9
+ tooltip: 'action.undo',
10
+ icon: mdi.mdiUndo,
11
+ enabled: true,
12
+ props: {
13
+ disabled: computed(() => !editor.can().chain().focus().undo().run()),
14
+ },
15
+ attrs: {
16
+ click: () => editor.chain().focus().undo().run()
17
+ }
18
+ },
19
+ redo: {
20
+ name: 'redo',
21
+ tooltip: 'action.redo',
22
+ icon: mdi.mdiRedo,
23
+ enabled: true,
24
+ props: {
25
+ disabled: computed(() => !editor.can().chain().focus().redo().run()),
26
+ },
27
+ attrs: {
28
+ click: () => editor.chain().focus().redo().run()
29
+ }
30
+ }
31
+ }
32
+ }