tiptapify 0.0.17 → 0.0.19

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tiptapify",
3
3
  "types": "./index.d.ts",
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -1,10 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import { Editor } from "@tiptap/vue-3";
3
3
  import Items from "@tiptapify/components/Toolbar/Items.vue";
4
- import { defineProps, inject, PropType, ref, Ref } from 'vue'
4
+ import { defineProps, inject, PropType, Ref } from 'vue'
5
5
  import { toolbarSections } from '@tiptapify/types/toolbarSections'
6
6
 
7
- import { default as items } from "@tiptapify/components/Toolbar/items";
7
+ import items from "@tiptapify/components/Toolbar/items";
8
8
 
9
9
  const props = defineProps({
10
10
  variantBtn: { type: String, default () { return 'elevated' }},
@@ -18,15 +18,16 @@ const props = defineProps({
18
18
  theme: { type: String, default() { return 'light' } },
19
19
  rounded: { type: String, default() { return '0' } },
20
20
  toolbarScrollable: { type: Boolean, default() { return false } },
21
- customExtensions: { type: Array as PropType<toolbarSections>, default() { return {} } },
21
+ customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
22
22
  })
23
23
 
24
24
  const editor = inject('tiptapifyEditor') as Ref<Editor>
25
25
 
26
- const toolbarItems = ref<Ref<toolbarSections>>(items)
26
+ // this prevents from overriding the default items
27
+ const toolbarItems = [...items]
27
28
 
28
- Object.keys(props.customExtensions).forEach(extension => {
29
- toolbarItems.value.push(props.customExtensions[extension])
29
+ Object.keys(props.customExtensions).forEach((key: any) => {
30
+ toolbarItems.push(props.customExtensions[key])
30
31
  })
31
32
 
32
33
  </script>
@@ -25,11 +25,12 @@ import { TableKit } from '@tiptap/extension-table'
25
25
  import { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight'
26
26
  import { InvisibleCharacters } from '@tiptap/extension-invisible-characters'
27
27
 
28
- import { TiptapifyLink } from '@tiptapify/extensions/components/media/link/link'
29
- import { TiptapifyImage } from '@tiptapify/extensions/components/media/image/image'
28
+ import { TiptapifyLink } from '@tiptapify/extensions/components/media/link'
29
+ import { TiptapifyImage } from '@tiptapify/extensions/components/media/image'
30
+ import { TiptapifyVideo } from '@tiptapify/extensions/components/media/video'
30
31
  import CodeBlockComponent from '@tiptapify/extensions/components/CodeBlockComponent.vue'
31
- import { ViewSource } from '@tiptapify/extensions/view-source'
32
- import { Preview } from '@tiptapify/extensions/preview'
32
+ import { ViewSource } from '@tiptapify/extensions/components/misc/source'
33
+ import { Preview } from '@tiptapify/extensions/components/misc/preview'
33
34
  import SlashCommands from '@tiptapify/extensions/slash-commands'
34
35
  import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
35
36
  import { toolbarSections } from "@tiptapify/types/toolbarSections";
@@ -83,6 +84,7 @@ export function editorExtensions (placeholder: string, slashCommands: boolean, c
83
84
  nocookie: true,
84
85
  }),
85
86
  TiptapifyImage,
87
+ TiptapifyVideo,
86
88
  Superscript,
87
89
  Subscript,
88
90
  TableKit,
@@ -37,9 +37,9 @@ const filterEmoji = (filterValue: string) => {
37
37
 
38
38
  const filtered: any[] = []
39
39
 
40
- const groupItems = emojisRef.value.find(item => item.group === tab.value)
40
+ const groupItems = emojisRef.value.find((item: any) => item.group === tab.value)
41
41
  if (groupItems?.emojis) {
42
- groupItems.emojis.forEach(item => {
42
+ groupItems.emojis.forEach((item: any) => {
43
43
  if (item.name.toLowerCase().match(filterValue)) {
44
44
  filtered.push(item)
45
45
  }
@@ -62,7 +62,7 @@ watch(() => tab.value, () => {
62
62
 
63
63
  <template>
64
64
  <VBtn
65
- id="tiptapify-emoji-button"
65
+ :id="`tiptapify-emoji-button-${editor.instanceId}`"
66
66
  :color="editor.isActive('image') ? 'primary' : ''"
67
67
  size="32"
68
68
  >
@@ -72,7 +72,7 @@ watch(() => tab.value, () => {
72
72
  <BtnIcon :icon="`mdiSvg:${mdi.mdiEmoticon}`" />
73
73
  </VBtn>
74
74
 
75
- <VMenu activator="#tiptapify-emoji-button" :close-on-content-click="false">
75
+ <VMenu :activator="`#tiptapify-emoji-button-${editor.instanceId}`" :close-on-content-click="false">
76
76
  <VSheet class="pa-2" max-width="570">
77
77
  <div class="d-flex flex-row">
78
78
  <VTabs v-model="tab" mandatory direction="vertical" color="primary" density="compact">
@@ -3,6 +3,7 @@
3
3
  import * as mdi from '@mdi/js'
4
4
  import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
+ import ImageDialog from "@tiptapify/extensions/components/media/image/ImageDialog.vue";
6
7
  import { inject, Ref } from "vue";
7
8
 
8
9
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -22,6 +23,8 @@ const { t } = inject('tiptapifyI18n') as any
22
23
  </VTooltip>
23
24
  <BtnIcon :icon="`mdiSvg:${mdi.mdiImage}`" />
24
25
  </VBtn>
26
+
27
+ <ImageDialog />
25
28
  </template>
26
29
 
27
30
  <style lang="scss" scoped>
@@ -3,6 +3,7 @@
3
3
  import * as mdi from '@mdi/js'
4
4
  import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
+ import LinkDialog from "@tiptapify/extensions/components/media/link/LinkDialog.vue";
6
7
  import { computed, inject, Ref } from "vue";
7
8
 
8
9
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -24,6 +25,8 @@ const icon = computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${m
24
25
  </VTooltip>
25
26
  <BtnIcon :icon="icon" />
26
27
  </VBtn>
28
+
29
+ <LinkDialog />
27
30
  </template>
28
31
 
29
32
  <style lang="scss" scoped>
@@ -28,7 +28,7 @@ const columnActionsDisabled = () => {
28
28
 
29
29
  <template>
30
30
  <VBtn
31
- id="tiptapify-table-button"
31
+ :id="`tiptapify-table-button-${editor.instanceId}`"
32
32
  :color="editor.isActive('table') ? 'primary' : ''"
33
33
  :disabled="!editor.can().chain().focus().insertTable().run()"
34
34
  size="32"
@@ -36,7 +36,7 @@ const columnActionsDisabled = () => {
36
36
  <BtnIcon :icon="`mdiSvg:${mdi.mdiTable}`" />
37
37
  </VBtn>
38
38
 
39
- <VMenu activator="#tiptapify-table-button" :close-on-content-click="false">
39
+ <VMenu :activator="`#tiptapify-table-button-${editor.instanceId}`" :close-on-content-click="false">
40
40
  <VList density="compact">
41
41
  <VListItem link>
42
42
  <VTooltip activator="parent">
@@ -49,7 +49,7 @@ const columnActionsDisabled = () => {
49
49
  <VMenu
50
50
  submenu
51
51
  activator="parent"
52
- :open-on-hover="false"
52
+ :open-on-hover="true"
53
53
  open-on-click
54
54
  :close-on-content-click="false"
55
55
  :disabled="!editor.can().chain().focus().insertTable().run()"
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { Editor } from "@tiptap/vue-3";
4
4
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
5
+ import VideoDialog from "@tiptapify/extensions/components/media/video/VideoDialog.vue";
5
6
  import { inject, Ref } from "vue";
6
7
 
7
8
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -22,6 +23,8 @@ const icon = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" vie
22
23
  </VTooltip>
23
24
  <BtnIcon :icon="icon" />
24
25
  </VBtn>
26
+
27
+ <VideoDialog />
25
28
  </template>
26
29
 
27
30
  <style lang="scss" scoped>
@@ -0,0 +1,32 @@
1
+ import { Extension } from '@tiptap/core'
2
+
3
+ const name: string = 'tiptapifyVideo'
4
+
5
+ declare module '@tiptap/core' {
6
+ interface Commands<ReturnType> {
7
+ tiptapifyVideo: {
8
+ showTiptapifyVideo: () => ReturnType
9
+ }
10
+ }
11
+ }
12
+
13
+ export const TiptapifyVideo = Extension.create({
14
+ name,
15
+
16
+ addCommands() {
17
+ return {
18
+ showTiptapifyVideo: () => ({ editor }) => {
19
+ const event = new CustomEvent(`tiptapify-show-${name}`, {
20
+ detail: {
21
+ video: editor.getAttributes('video'),
22
+ editorId: editor.instanceId
23
+ }
24
+ })
25
+
26
+ window.dispatchEvent(event)
27
+
28
+ return true
29
+ },
30
+ }
31
+ },
32
+ })
@@ -28,7 +28,7 @@ const selectedColor = computed(() => editor.value.getAttributes('textStyle').col
28
28
 
29
29
  <template>
30
30
  <VBtn
31
- id="tiptapify-color-button"
31
+ :id="`tiptapify-color-button-${editor.instanceId}`"
32
32
  :disabled="!editor.can().chain().focus().toggleHighlight().run()"
33
33
  @click="editor.chain().focus().redo().run()"
34
34
  size="32"
@@ -47,7 +47,7 @@ const selectedColor = computed(() => editor.value.getAttributes('textStyle').col
47
47
  />
48
48
  </VBtn>
49
49
 
50
- <VMenu activator="#tiptapify-color-button">
50
+ <VMenu :activator="`#tiptapify-color-button-${editor.instanceId}`">
51
51
  <StyleColor :font-color="true" :background-color="false" :color="selectedColor" />
52
52
  </VMenu>
53
53
  </template>
@@ -39,7 +39,7 @@ function getColor() {
39
39
 
40
40
  <template>
41
41
  <VBtn
42
- id="tiptapify-font-family-button"
42
+ :id="`tiptapify-font-family-button-${editor.instanceId}`"
43
43
  :disabled="!editor.can().chain().focus().unsetFontFamily().run()"
44
44
  :color="getColor()"
45
45
  size="32"
@@ -50,7 +50,7 @@ function getColor() {
50
50
  <BtnIcon :icon="`mdiSvg:${mdi.mdiFormatFont}`" />
51
51
  </VBtn>
52
52
 
53
- <VMenu activator="#tiptapify-font-family-button">
53
+ <VMenu :activator="`#tiptapify-font-family-button-${editor.instanceId}`">
54
54
  <FontFamily :fonts="fonts" :font-family="activeFontFamily" />
55
55
  </VMenu>
56
56
  </template>
@@ -43,7 +43,7 @@ function getColor() {
43
43
 
44
44
  <template>
45
45
  <VBtn
46
- id="tiptapify-font-size-button"
46
+ :id="`tiptapify-font-size-button-${editor.instanceId}`"
47
47
  :disabled="!editor.can().chain().focus().unsetFontSize().run()"
48
48
  :color="getColor()"
49
49
  size="32"
@@ -54,7 +54,7 @@ function getColor() {
54
54
  <BtnIcon :icon="`mdiSvg:${mdi.mdiFormatSize}`" />
55
55
  </VBtn>
56
56
 
57
- <VMenu activator="#tiptapify-font-size-button">
57
+ <VMenu :activator="`#tiptapify-font-size-button-${editor.instanceId}`">
58
58
  <FontSize :sizes="fontSizes" :measure="fontMeasure" :font-size="activeFontSize" />
59
59
  </VMenu>
60
60
  </template>
@@ -25,7 +25,7 @@ setHeadingLevels(props.customHeadingLevels)
25
25
 
26
26
  <template>
27
27
  <VBtn
28
- id="tiptapify-heading-button"
28
+ :id="`tiptapify-heading-button-${editor.instanceId}`"
29
29
  :color="editor.isActive('heading') ? 'primary' : ''"
30
30
  @click="editor.chain().focus().redo().run()"
31
31
  size="32"
@@ -36,7 +36,7 @@ setHeadingLevels(props.customHeadingLevels)
36
36
  <BtnIcon :icon="`mdiSvg:${mdi.mdiFormatHeaderPound}`" />
37
37
  </VBtn>
38
38
 
39
- <VMenu activator="#tiptapify-heading-button">
39
+ <VMenu :activator="`#tiptapify-heading-button-${editor.instanceId}`">
40
40
  <VList density="compact">
41
41
  <VListItem link :color="editor.isActive('paragraph') ? 'primary' : ''" @click="editor.chain().focus().setParagraph().run()">
42
42
  <VListItemTitle class="d-flex justify-center align-center">
@@ -28,7 +28,7 @@ const selectedColor = computed(() => editor.value.getAttributes('highlight').col
28
28
 
29
29
  <template>
30
30
  <VBtn
31
- id="tiptapify-highlight-button"
31
+ :id="`tiptapify-highlight-button-${editor.instanceId}`"
32
32
  :disabled="!editor.can().chain().focus().toggleHighlight().run()"
33
33
  @click="editor.chain().focus().redo().run()"
34
34
  size="32"
@@ -47,7 +47,7 @@ const selectedColor = computed(() => editor.value.getAttributes('highlight').col
47
47
  />
48
48
  </VBtn>
49
49
 
50
- <VMenu activator="#tiptapify-highlight-button">
50
+ <VMenu :activator="`#tiptapify-highlight-button-${editor.instanceId}`">
51
51
  <StyleColor :font-color="false" :background-color="true" :color="selectedColor" />
52
52
  </VMenu>
53
53
  </template>
@@ -39,7 +39,7 @@ function getColor() {
39
39
 
40
40
  <template>
41
41
  <VBtn
42
- id="tiptapify-line-height-button"
42
+ :id="`tiptapify-line-height-button-${editor.instanceId}`"
43
43
  :disabled="!editor.can().chain().focus().unsetLineHeight().run()"
44
44
  :color="getColor()"
45
45
  size="32"
@@ -50,7 +50,7 @@ function getColor() {
50
50
  <BtnIcon :icon="`mdiSvg:${mdi.mdiFormatLineHeight}`" />
51
51
  </VBtn>
52
52
 
53
- <VMenu activator="#tiptapify-line-height-button">
53
+ <VMenu :activator="`#tiptapify-line-height-button-${editor.instanceId}`">
54
54
  <LineHeight :line-heights="lineHeights" :line-height="activeLineHeight" />
55
55
  </VMenu>
56
56
  </template>