tiptapify 0.0.32 → 0.0.34

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.32",
4
+ "version": "0.0.34",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -145,7 +145,17 @@ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTit
145
145
  }
146
146
 
147
147
  Object.keys(props.customExtensions).forEach((key: any) => {
148
- toolbarItems.push(props.customExtensions[key])
148
+ const existingSection = toolbarItems.find(item => item.section === props.customExtensions[key].section)
149
+ if (existingSection) {
150
+ for (const component of props.customExtensions[key].components) {
151
+ const existingComponent = existingSection.components.find(_component => _component.name === component.name)
152
+ if (existingComponent) {
153
+ existingComponent.component = component.component
154
+ }
155
+ }
156
+ } else {
157
+ toolbarItems.push(props.customExtensions[key])
158
+ }
149
159
  })
150
160
 
151
161
  </script>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
 
3
+ import * as mdi from "@mdi/js";
3
4
  import { Editor } from "@tiptap/vue-3";
4
5
  import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
5
6
  import defaults from "@tiptapify/constants/defaults";
@@ -30,6 +31,37 @@ const isDisabled = computed(() => {
30
31
  return !src
31
32
  })
32
33
 
34
+ const keepRatio = ref(true)
35
+ const ratio = ref(null)
36
+ function setRatio(force: boolean = false) {
37
+ if (!keepRatio.value && !force) {
38
+ return
39
+ }
40
+
41
+ if ((!ratio.value || force) && attrs.value.width && attrs.value.height) {
42
+ ratio.value = parseFloat(attrs.value.width / attrs.value.height).toFixed(4)
43
+ }
44
+ }
45
+ function updateSizeRatio(dim: string) {
46
+ if (!ratio.value || !attrs.value.width || !attrs.value.height) {
47
+ return
48
+ }
49
+
50
+ if (!keepRatio.value) {
51
+ setRatio(true)
52
+ return
53
+ }
54
+
55
+ const source = dim.toLowerCase()
56
+ const sizeRatio = source === 'width'
57
+ ? (attrs.value.width / ratio.value)
58
+ : (attrs.value.height * ratio.value)
59
+
60
+ const target = source === 'width' ? 'height' : 'width'
61
+
62
+ attrs.value[target] = parseFloat(sizeRatio).toFixed(0)
63
+ }
64
+
33
65
  function apply() {
34
66
  let { src, alt, width, height } = attrs.value
35
67
 
@@ -63,6 +95,7 @@ function close() {
63
95
  dialog.value.close()
64
96
 
65
97
  attrs.value = generateImageAttrs()
98
+ ratio.value = null
66
99
  }
67
100
 
68
101
  const showTiptapifyImage = (event: CustomEvent) => {
@@ -96,16 +129,45 @@ onUnmounted(() => {
96
129
  <VTextField v-model="attrs.src" density="compact" variant="outlined" :label="t('dialog.image.src')" />
97
130
  </VCol>
98
131
 
99
- <VCol cols="12" md="6">
132
+ <VCol cols="12" md="5">
100
133
  <VTextField v-model="attrs.alt" density="compact" variant="outlined" :label="t('dialog.image.alt')" />
101
134
  </VCol>
102
135
 
103
- <VCol cols="12" md="3">
104
- <VTextField v-model="attrs.width" type="number" density="compact" variant="outlined" :precision="0" :min="1" :label="t('dialog.image.width')" />
136
+ <VCol cols="5" md="3">
137
+ <VTextField
138
+ v-model="attrs.width"
139
+ type="number"
140
+ density="compact"
141
+ variant="outlined"
142
+ :precision="0"
143
+ :min="1"
144
+ :label="t('dialog.image.width')"
145
+ @change="setRatio"
146
+ @update:model-value="updateSizeRatio('width')"
147
+ />
148
+ </VCol>
149
+
150
+ <VCol cols="5" md="3">
151
+ <VTextField
152
+ v-model="attrs.height"
153
+ type="number"
154
+ density="compact"
155
+ variant="outlined"
156
+ :precision="0"
157
+ :min="1"
158
+ :label="t('dialog.image.height')"
159
+ @change="setRatio"
160
+ @update:model-value="updateSizeRatio('height')"
161
+ />
105
162
  </VCol>
106
163
 
107
- <VCol cols="12" md="3">
108
- <VTextField v-model="attrs.height" type="number" density="compact" variant="outlined" :precision="0" :min="1" :label="t('dialog.image.height')" />
164
+ <VCol cols="2" md="1">
165
+ <VBtn size="40" :variant="variantBtn" v-model="keepRatio" @click="keepRatio = !keepRatio">
166
+ <VIcon :icon="keepRatio ? `mdiSvg:${mdi.mdiLock}` : `mdiSvg:${mdi.mdiLockOpen}`" />
167
+ <VTooltip activator="parent">
168
+ {{ t('dialog.image.keep_ratio') }}
169
+ </VTooltip>
170
+ </VBtn>
109
171
  </VCol>
110
172
  </VRow>
111
173
  </VCardText>
@@ -0,0 +1,153 @@
1
+ {
2
+ "defaultValue": "القيمة الافتراضية",
3
+ "content": {
4
+ "placeholder": "اكتب شيئاً..."
5
+ },
6
+ "style": {
7
+ "paragraph": "فقرة",
8
+ "heading": "عنوان رئيسي",
9
+ "headings": {
10
+ "h1": "عنوان المستوى الأول",
11
+ "h2": "عنوان المستوى الثاني",
12
+ "h3": "عنوان المستوى الثالث",
13
+ "h4": "عنوان المستوى الرابع",
14
+ "h5": "عنوان المستوى الخامس",
15
+ "h6": "عنوان المستوى السادس"
16
+ },
17
+ "fontFamily": "عائلة الخطوط",
18
+ "fontSize": "حجم الخط",
19
+ "lineHeight": "ارتفاع السطر",
20
+ "color": {
21
+ "highlight": "لون التحديد",
22
+ "text": "لون النص",
23
+ "unset": "إزالة اللون",
24
+ "custom": "تحديد مخصص"
25
+ }
26
+ },
27
+ "format": {
28
+ "bold": "عريض",
29
+ "italic": "مائل",
30
+ "strike": "مشطوب",
31
+ "underline": "تسطير",
32
+ "sup": "أس فوق السطر",
33
+ "sub": "أس تحت السطر",
34
+ "break": "كسر سطر قسري",
35
+ "line": "خط أفقي",
36
+ "blockquote": "اقتباس",
37
+ "code": "شفرة برمجية",
38
+ "codeblock": "كتلة شفرة",
39
+ "formatClear": "مسح التنسيق"
40
+ },
41
+ "media": {
42
+ "link": "رابط خارجي",
43
+ "iframe": "إطار مضمن",
44
+ "image": "صورة",
45
+ "emoji": {
46
+ "title": "رموز تعبيرية",
47
+ "activities": "أنشطة",
48
+ "animals_and_nature": "حيوانات وطبيعة",
49
+ "component": "مكون",
50
+ "flags": "أعلام",
51
+ "food_and_drink": "طعام وشراب",
52
+ "objects": "أشياء",
53
+ "people_and_body": "أشخاص وجسد",
54
+ "smileys_and_emotion": "ابتسامات ومشاعر",
55
+ "symbols": "رموز",
56
+ "travel_and_places": "سفر وأماكن"
57
+ },
58
+ "tables": {
59
+ "table": "جدول",
60
+ "insertTable": "إدراج جدول",
61
+ "deleteTable": "حذف جدول",
62
+ "insertWithHeaderRow": "إدراج جدول مع صف ترويسة",
63
+ "rows": "صفوف",
64
+ "row": "صف",
65
+ "insertRowBefore": "إدراج صف قبل",
66
+ "insertRowAfter": "إدراج صف بعد",
67
+ "deleteRow": "حذف صف",
68
+ "cols": "أعمدة",
69
+ "col": "عمود",
70
+ "insertColBefore": "إدراج عمود قبل",
71
+ "insertColAfter": "إدراج عمود بعد",
72
+ "deleteCol": "حذف عمود",
73
+ "mergeCells": "دمج الخلايا",
74
+ "splitCell": "تقسيم الخلية"
75
+ },
76
+ "video": "فيديو"
77
+ },
78
+ "action": {
79
+ "undo": "تراجع",
80
+ "redo": "إعادة"
81
+ },
82
+ "alignment": "محاذاة",
83
+ "alignments": {
84
+ "left": "محاذاة لليسار",
85
+ "center": "محاذاة إلى المنتصف",
86
+ "right": "محاذاة لليمين",
87
+ "justify": "ضبط"
88
+ },
89
+ "list": "قائمة",
90
+ "lists": {
91
+ "bullet": "قائمة غير مرقمة",
92
+ "numbered": "قائمة مرقمة",
93
+ "task": "قائمة مهام",
94
+ "indent": "زيادة المسافة البادئة",
95
+ "outdent": "تقليل المسافة البادئة"
96
+ },
97
+ "dialog": {
98
+ "apply": "تطبيق",
99
+ "clear": "مسح",
100
+ "close": "إغلاق",
101
+ "iframe": {
102
+ "dialog_title": "إضافة/تعديل إطار مضمن",
103
+ "src": "المصدر",
104
+ "name": "الاسم",
105
+ "title": "العنوان",
106
+ "width": "العرض",
107
+ "height": "الارتفاع",
108
+ "frameborder": "حدود الإطار",
109
+ "src_invalid": "عنوان URL المدخل غير صالح"
110
+ },
111
+ "image": {
112
+ "title": "إضافة/تعديل صورة",
113
+ "src": "المصدر",
114
+ "keep_ratio": "الحفاظ على نسبة العرض إلى الارتفاع",
115
+ "alt": "نص بديل",
116
+ "width": "العرض",
117
+ "height": "الارتفاع"
118
+ },
119
+ "link": {
120
+ "title": "إضافة/تعديل رابط",
121
+ "href": "عنوان الرابط",
122
+ "href_error": "عنوان رابط غير صالح",
123
+ "target": "افتح في...",
124
+ "target_blank": "نافذة جديدة",
125
+ "target_self": "النافذة الحالية",
126
+ "rel": "نسبة",
127
+ "class": "فئة CSS"
128
+ },
129
+ "preview": {
130
+ "title": "معاينة"
131
+ },
132
+ "source": {
133
+ "title": "عرض كود المصدر",
134
+ "prettify": "تنسيق"
135
+ },
136
+ "video": {
137
+ "title": "إضافة/تعديل فيديو",
138
+ "src": "المصدر",
139
+ "width": "العرض",
140
+ "height": "الارتفاع"
141
+ }
142
+ },
143
+ "misc": {
144
+ "fullscreen": "وضع ملء الشاشة",
145
+ "preview": "معاينة",
146
+ "source": "عرض كود المصدر",
147
+ "toggleInvisibleCharacters": "إظهار/إخفاء الأحرف غير المرئية"
148
+ },
149
+ "footer": {
150
+ "words": "كلمات",
151
+ "chars": "حروف"
152
+ }
153
+ }
@@ -40,8 +40,10 @@
40
40
  },
41
41
  "media": {
42
42
  "link": "外部链接",
43
+ "iframe": "iframe",
43
44
  "image": "图片",
44
45
  "emoji": {
46
+ "title": "表情符号",
45
47
  "activities": "活动",
46
48
  "animals_and_nature": "动物与自然",
47
49
  "component": "组件",
@@ -70,7 +72,8 @@
70
72
  "deleteCol": "删除列",
71
73
  "mergeCells": "合并单元格",
72
74
  "splitCell": "拆分单元格"
73
- }
75
+ },
76
+ "video": "视频"
74
77
  },
75
78
  "action": {
76
79
  "undo": "撤销",
@@ -108,6 +111,7 @@
108
111
  "image": {
109
112
  "title": "添加/修改图片",
110
113
  "src": "源",
114
+ "keep_ratio": "保持比例",
111
115
  "alt": "替代文本",
112
116
  "width": "宽度",
113
117
  "height": "高度"
@@ -40,8 +40,10 @@
40
40
  },
41
41
  "media": {
42
42
  "link": "Externí odkaz",
43
+ "iframe": "iframe",
43
44
  "image": "Obrázek",
44
45
  "emoji": {
46
+ "title": "Emoji",
45
47
  "activities": "Aktivity",
46
48
  "animals_and_nature": "Zvířata a příroda",
47
49
  "component": "Komponenta",
@@ -70,7 +72,8 @@
70
72
  "deleteCol": "Smazat sloupec",
71
73
  "mergeCells": "Sloučit buňky",
72
74
  "splitCell": "Rozdělit buňku"
73
- }
75
+ },
76
+ "video": "Video"
74
77
  },
75
78
  "action": {
76
79
  "undo": "Zpět",
@@ -108,6 +111,7 @@
108
111
  "image": {
109
112
  "title": "Přidání/úprava obrázku",
110
113
  "src": "Zdroj",
114
+ "keep_ratio": "Udržet poměr stran",
111
115
  "alt": "alt",
112
116
  "width": "Šířka",
113
117
  "height": "Výška"
@@ -40,8 +40,10 @@
40
40
  },
41
41
  "media": {
42
42
  "link": "Externer Link",
43
+ "iframe": "iframe",
43
44
  "image": "Bild",
44
45
  "emoji": {
46
+ "title": "Emoji",
45
47
  "activities": "Aktivitäten",
46
48
  "animals_and_nature": "Tiere & Natur",
47
49
  "component": "Komponente",
@@ -70,7 +72,8 @@
70
72
  "deleteCol": "Spalte löschen",
71
73
  "mergeCells": "Zellen zusammenführen",
72
74
  "splitCell": "Zelle teilen"
73
- }
75
+ },
76
+ "video": "Video"
74
77
  },
75
78
  "action": {
76
79
  "undo": "Rückgängig",
@@ -108,6 +111,7 @@
108
111
  "image": {
109
112
  "title": "Bild hinzufügen/ändern",
110
113
  "src": "Quelle",
114
+ "keep_ratio": "Seitenverhältnis beibehalten",
111
115
  "alt": "alt",
112
116
  "width": "Breite",
113
117
  "height": "Höhe"
@@ -111,6 +111,7 @@
111
111
  "image": {
112
112
  "title": "Add/edit image",
113
113
  "src": "Source",
114
+ "keep_ratio": "Keep ratio",
114
115
  "alt": "Alt",
115
116
  "width": "Width",
116
117
  "height": "Height"
@@ -40,8 +40,10 @@
40
40
  },
41
41
  "media": {
42
42
  "link": "Enlace externo",
43
+ "iframe": "iframe",
43
44
  "image": "Imagen",
44
45
  "emoji": {
46
+ "title": "Emoji",
45
47
  "activities": "Actividades",
46
48
  "animals_and_nature": "Animales y naturaleza",
47
49
  "component": "Componente",
@@ -70,7 +72,8 @@
70
72
  "deleteCol": "Eliminar columna",
71
73
  "mergeCells": "Fusionar celdas",
72
74
  "splitCell": "Dividir celda"
73
- }
75
+ },
76
+ "video": "Video"
74
77
  },
75
78
  "action": {
76
79
  "undo": "Deshacer",
@@ -108,6 +111,7 @@
108
111
  "image": {
109
112
  "title": "Agregar/modificar imagen",
110
113
  "src": "Fuente",
114
+ "keep_ratio": "Mantener proporción",
111
115
  "alt": "alt",
112
116
  "width": "Ancho",
113
117
  "height": "Alto"
@@ -0,0 +1,153 @@
1
+ {
2
+ "defaultValue": "Oletusarvo",
3
+ "content": {
4
+ "placeholder": "Kirjoita jotain..."
5
+ },
6
+ "style": {
7
+ "paragraph": "Kappale",
8
+ "heading": "Otsikko",
9
+ "headings": {
10
+ "h1": "Otsikon taso 1",
11
+ "h2": "Otsikon taso 2",
12
+ "h3": "Otsikon taso 3",
13
+ "h4": "Otsikon taso 4",
14
+ "h5": "Otsikon taso 5",
15
+ "h6": "Otsikon taso 6"
16
+ },
17
+ "fontFamily": "Fonttiperhe",
18
+ "fontSize": "Kirjasinkoko",
19
+ "lineHeight": "Rivin korkeus",
20
+ "color": {
21
+ "highlight": "Korostuksen väri",
22
+ "text": "Tekstin väri",
23
+ "unset": "Poista väri",
24
+ "custom": "Mukautettu valinta"
25
+ }
26
+ },
27
+ "format": {
28
+ "bold": "Lihavoitu",
29
+ "italic": "Kursiivi",
30
+ "strike": "Yliviivattu",
31
+ "underline": "Alleviivattu",
32
+ "sup": "Yläindeksi",
33
+ "sub": "Alikindeksi",
34
+ "break": "Rivin katkaisu",
35
+ "line": "Vaakatason viiva",
36
+ "blockquote": "Lainaus",
37
+ "code": "Koodi",
38
+ "codeblock": "Koodilohko",
39
+ "formatClear": "Poista muotoilu"
40
+ },
41
+ "media": {
42
+ "link": "Ulkoisen linkin",
43
+ "iframe": "iframe",
44
+ "image": "Kuva",
45
+ "emoji": {
46
+ "title": "Emoji",
47
+ "activities": "Toiminnot",
48
+ "animals_and_nature": "Eläimet ja luonto",
49
+ "component": "Komponentti",
50
+ "flags": "Liput",
51
+ "food_and_drink": "Ruoka ja juoma",
52
+ "objects": "Objektit",
53
+ "people_and_body": "Ihmiset ja ruumis",
54
+ "smileys_and_emotion": "Hymyjä ja tunteita",
55
+ "symbols": "Symbolit",
56
+ "travel_and_places": "Matkustaminen ja paikat"
57
+ },
58
+ "tables": {
59
+ "table": "Taulukko",
60
+ "insertTable": "Lisää taulukko",
61
+ "deleteTable": "Poista taulukko",
62
+ "insertWithHeaderRow": "Lisää taulukko otsikkorivillä",
63
+ "rows": "Rivit",
64
+ "row": "Rivi",
65
+ "insertRowBefore": "Lisää rivi ennen",
66
+ "insertRowAfter": "Lisää rivi jälkeen",
67
+ "deleteRow": "Poista rivi",
68
+ "cols": "Sarakkeet",
69
+ "col": "Sarake",
70
+ "insertColBefore": "Lisää sarake ennen",
71
+ "insertColAfter": "Lisää sarake jälkeen",
72
+ "deleteCol": "Poista sarake",
73
+ "mergeCells": "Yhdistä solut",
74
+ "splitCell": "Jaa solu"
75
+ },
76
+ "video": "Video"
77
+ },
78
+ "action": {
79
+ "undo": "Kumoa",
80
+ "redo": "Tee uudelleen"
81
+ },
82
+ "alignment": "Tasaus",
83
+ "alignments": {
84
+ "left": "Vasemmalle tasattu",
85
+ "center": "Keskitetty",
86
+ "right": "Oikealle tasattu",
87
+ "justify": "Tasaa"
88
+ },
89
+ "list": "Lista",
90
+ "lists": {
91
+ "bullet": "Luettelomerkki-luettelo",
92
+ "numbered": "Numeroiden luettelo",
93
+ "task": "Tehtävälista",
94
+ "indent": "Lisää sisennystä",
95
+ "outdent": "Vähennä sisennystä"
96
+ },
97
+ "dialog": {
98
+ "apply": "Käytä",
99
+ "clear": "Tyhjennä",
100
+ "close": "Sulje",
101
+ "iframe": {
102
+ "dialog_title": "Lisää/muokkaa iframe",
103
+ "src": "Lähde",
104
+ "name": "Nimi",
105
+ "title": "Otsikko",
106
+ "width": "Leveys",
107
+ "height": "Korkeus",
108
+ "frameborder": "Iframe-reunalinja",
109
+ "src_invalid": "Syötetty URL ei ole kelvollinen"
110
+ },
111
+ "image": {
112
+ "title": "Lisää/muokkaa kuvaa",
113
+ "src": "Lähde",
114
+ "keep_ratio": "Säilytä suhde",
115
+ "alt": "Vaihtoehtoinen teksti",
116
+ "width": "Leveys",
117
+ "height": "Korkeus"
118
+ },
119
+ "link": {
120
+ "title": "Lisää/muokkaa linkkiä",
121
+ "href": "Linkin osoite",
122
+ "href_error": "Virheellinen linkin osoite",
123
+ "target": "Avaa...",
124
+ "target_blank": "Uuteen ikkunaan",
125
+ "target_self": "Nykyiseen ikkunaan",
126
+ "rel": "suhteessa",
127
+ "class": "CSS-luokka"
128
+ },
129
+ "preview": {
130
+ "title": "Esikatselu"
131
+ },
132
+ "source": {
133
+ "title": "Näytä lähdekoodi",
134
+ "prettify": "Muotoile"
135
+ },
136
+ "video": {
137
+ "title": "Lisää/muokkaa videoa",
138
+ "src": "Lähde",
139
+ "width": "Leveys",
140
+ "height": "Korkeus"
141
+ }
142
+ },
143
+ "misc": {
144
+ "fullscreen": "Täysi-ikkuna tila",
145
+ "preview": "Esikatselu",
146
+ "source": "Näytä lähdekoodi",
147
+ "toggleInvisibleCharacters": "Näytä/piilota näkymättömät merkit"
148
+ },
149
+ "footer": {
150
+ "words": "sanaa",
151
+ "chars": "merkkiä"
152
+ }
153
+ }
@@ -1,4 +1,3 @@
1
-
2
1
  {
3
2
  "defaultValue": "Valeur par défaut",
4
3
  "content": {
@@ -41,8 +40,10 @@
41
40
  },
42
41
  "media": {
43
42
  "link": "Lien externe",
43
+ "iframe": "iframe",
44
44
  "image": "Image",
45
45
  "emoji": {
46
+ "title": "Emoji",
46
47
  "activities": "Activités",
47
48
  "animals_and_nature": "Animaux et nature",
48
49
  "component": "Composant",
@@ -71,7 +72,8 @@
71
72
  "deleteCol": "Supprimer la colonne",
72
73
  "mergeCells": "Fusionner les cellules",
73
74
  "splitCell": "Diviser la cellule"
74
- }
75
+ },
76
+ "video": "Vidéo"
75
77
  },
76
78
  "action": {
77
79
  "undo": "Annuler",
@@ -109,6 +111,7 @@
109
111
  "image": {
110
112
  "title": "Ajouter/modifier l'image",
111
113
  "src": "Source",
114
+ "keep_ratio": "Conserver le ratio d'aspect",
112
115
  "alt": "alt",
113
116
  "width": "Largeur",
114
117
  "height": "Hauteur"