tiptapify 0.0.7 → 0.0.8

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.
@@ -7,6 +7,8 @@ import helpers from "@tiptapify/utils/helpers";
7
7
 
8
8
  const props = defineProps({
9
9
  indent: { type: Number, default: 2 },
10
+ variantBtn: { type: String, default: 'elevated' },
11
+ variantField: { type: String, default: 'solo' }
10
12
  })
11
13
 
12
14
  const { ucFirst } = helpers;
@@ -97,17 +99,17 @@ watch(() => formatted.value, () => {
97
99
  v-model="sourceCode"
98
100
  no-resize
99
101
  rows="100"
100
- variant="outlined"
102
+ :variant="variantField"
101
103
  class="source-code-area"
102
104
  />
103
105
  </VCardText>
104
106
 
105
107
  <VCardActions>
106
108
  <VSpacer></VSpacer>
107
- <VBtn color="primary" @click="dialog = false">
109
+ <VBtn :variant="variantBtn" @click="dialog = false">
108
110
  {{ ucFirst(t('dialog.close')) }}
109
111
  </VBtn>
110
- <VBtn color="primary" @click="saveChanges">
112
+ <VBtn :variant="variantBtn" color="primary" @click="saveChanges">
111
113
  {{ ucFirst(t('dialog.apply')) }}
112
114
  </VBtn>
113
115
  </VCardActions>
@@ -56,7 +56,7 @@ function printSelection() {
56
56
  v-model="withHeaderRow"
57
57
  density="compact"
58
58
  color="primary"
59
- :label="ucFirst(t('format.tables.insertWithHeaderRow'))" hide-details
59
+ :label="ucFirst(t('media.tables.insertWithHeaderRow'))" hide-details
60
60
  />
61
61
 
62
62
  <div v-for="rowNum in maxRows" :key="`row-${rowNum}`" class="tiptapify-insert-table-row">
@@ -74,8 +74,8 @@ function printSelection() {
74
74
 
75
75
  <div class="tiptapify-table-builder-info">
76
76
  <span>
77
- {{ ucFirst(t('format.tables.rows')) }}: {{ rowHover }}
78
- {{ ucFirst(t('format.tables.cols')) }}: {{ colHover }}
77
+ {{ ucFirst(t('media.tables.rows')) }}: {{ rowHover }}
78
+ {{ ucFirst(t('media.tables.cols')) }}: {{ colHover }}
79
79
  </span>
80
80
  <span>
81
81
  {{ printSelection() }}
@@ -0,0 +1,31 @@
1
+ import { Extension } from '@tiptap/core'
2
+
3
+ const name: string = 'tiptapifyImage'
4
+
5
+ declare module '@tiptap/core' {
6
+ interface Commands<ReturnType> {
7
+ tiptapifyImage: {
8
+ showTiptapifyImage: () => ReturnType
9
+ }
10
+ }
11
+ }
12
+
13
+ export const TiptapifyImage = Extension.create({
14
+ name,
15
+
16
+ addCommands() {
17
+ return {
18
+ showTiptapifyImage: () => ({ editor }) => {
19
+ const event = new CustomEvent(`tiptapify-show-${name}`, {
20
+ detail: {
21
+ image: editor.getAttributes('image')
22
+ }
23
+ })
24
+
25
+ window.dispatchEvent(event)
26
+
27
+ return true
28
+ },
29
+ }
30
+ },
31
+ })
@@ -0,0 +1,24 @@
1
+ import Link from "@tiptap/extension-link";
2
+
3
+ const name: string = 'link'
4
+
5
+ export const TiptapifyLink = Link.extend({
6
+ name,
7
+
8
+ addCommands() {
9
+ return {
10
+ ...this.parent?.(),
11
+ showLink: () => ({ editor }) => {
12
+ const event = new CustomEvent(`tiptapify-show-${name}`, {
13
+ detail: {
14
+ link: editor.getAttributes('link')
15
+ }
16
+ })
17
+
18
+ window.dispatchEvent(event)
19
+
20
+ return true
21
+ },
22
+ }
23
+ },
24
+ })
@@ -3,34 +3,21 @@ import { Plugin, PluginKey } from '@tiptap/pm/state'
3
3
 
4
4
  const name: string = 'preview'
5
5
 
6
- export interface ViewSourceOptions {
7
- HTMLAttributes: Record<string, any>
8
- }
9
-
10
6
  declare module '@tiptap/core' {
11
7
  interface Commands<ReturnType> {
12
8
  preview: {
13
- /**
14
- * Показать исходный HTML-код
15
- */
16
9
  showPreview: () => ReturnType
17
10
  }
18
11
  }
19
12
  }
20
13
 
21
- export const Preview = Extension.create<ViewSourceOptions>({
14
+ export const Preview = Extension.create({
22
15
  name,
23
16
 
24
- addOptions() {
25
- return {
26
- HTMLAttributes: {},
27
- }
28
- },
29
-
30
17
  addCommands() {
31
18
  return {
32
19
  showPreview: () => ({ editor }) => {
33
- const event = new CustomEvent('tiptapify-show-preview', {
20
+ const event = new CustomEvent(`tiptapify-show-${name}`, {
34
21
  detail: {
35
22
  html: editor.getHTML()
36
23
  }
@@ -8,9 +8,6 @@ export interface ViewSourceOptions {
8
8
  declare module '@tiptap/core' {
9
9
  interface Commands<ReturnType> {
10
10
  viewSource: {
11
- /**
12
- * Показать исходный HTML-код
13
- */
14
11
  showSource: () => ReturnType
15
12
  }
16
13
  }
@@ -21,14 +21,17 @@
21
21
  "underline": "unterstrichen",
22
22
  "sup": "hochgestellt",
23
23
  "sub": "tiefgestellt",
24
- "break": "zeilenumbruch",
24
+ "break": "harter umbruch",
25
25
  "highlight": "hervorheben",
26
26
  "line": "horizontale linie",
27
27
  "blockquote": "zitat",
28
28
  "code": "code",
29
- "codeblock": "codeblock",
29
+ "codeblock": "code block",
30
+ "formatClear": "formatierung löschen"
31
+ },
32
+ "media": {
30
33
  "link": "externer link",
31
- "formatClear": "formatierung löschen",
34
+ "image": "bild",
32
35
  "tables": {
33
36
  "table": "tabelle",
34
37
  "insertTable": "tabelle einfügen",
@@ -36,13 +39,13 @@
36
39
  "insertWithHeaderRow": "tabelle mit kopfzeile einfügen",
37
40
  "rows": "zeilen",
38
41
  "row": "zeile",
39
- "insertRowBefore": "zeile oberhalb einfügen",
40
- "insertRowAfter": "zeile unterhalb einfügen",
42
+ "insertRowBefore": "zeile davor einfügen",
43
+ "insertRowAfter": "zeile danach einfügen",
41
44
  "deleteRow": "zeile löschen",
42
45
  "cols": "spalten",
43
46
  "col": "spalte",
44
- "insertColBefore": "spalte links einfügen",
45
- "insertColAfter": "spalte rechts einfügen",
47
+ "insertColBefore": "spalte davor einfügen",
48
+ "insertColAfter": "spalte danach einfügen",
46
49
  "deleteCol": "spalte löschen",
47
50
  "mergeCells": "zellen verbinden",
48
51
  "splitCell": "zelle teilen"
@@ -50,33 +53,44 @@
50
53
  },
51
54
  "action": {
52
55
  "undo": "rückgängig",
53
- "redo": "wiederherstellen"
56
+ "redo": "wiederholen"
54
57
  },
55
58
  "alignment": "ausrichtung",
56
59
  "alignments": {
57
- "left": "linksbündig",
58
- "center": "zentriert",
59
- "right": "rechtsbündig",
60
+ "left": "links ausrichten",
61
+ "center": "zentriert ausrichten",
62
+ "right": "rechts ausrichten",
60
63
  "justify": "blocksatz"
61
64
  },
62
65
  "list": "liste",
63
66
  "lists": {
64
- "bullet": "aufzählungsliste",
65
- "numbered": "nummerierte liste",
67
+ "bullet": "ungeordnete liste",
68
+ "numbered": "geordnete liste",
66
69
  "task": "aufgabenliste",
67
- "indent": "einzug vergrößern",
68
- "outdent": "einzug verkleinern"
70
+ "indent": "listenelement einrücken",
71
+ "outdent": "listenelement ausrücken"
69
72
  },
70
73
  "dialog": {
71
- "close": "schließen",
72
74
  "apply": "anwenden",
75
+ "clear": "löschen",
76
+ "close": "schließen",
77
+ "image": {
78
+ "title": "bild hinzufügen/bearbeiten",
79
+ "src": "quelle",
80
+ "alt": "alt",
81
+ "width": "breite",
82
+ "height": "höhe"
83
+ },
73
84
  "link": {
74
85
  "title": "link hinzufügen/bearbeiten",
75
- "placeholder": "linkadresse"
86
+ "href": "link-adresse",
87
+ "target": "in neuem fenster öffnen",
88
+ "rel": "rel",
89
+ "class": "css-klasse"
76
90
  },
77
91
  "source": {
78
92
  "title": "quellcode anzeigen",
79
- "prettify": "formatieren"
93
+ "prettify": "verschönern"
80
94
  }
81
95
  },
82
96
  "misc": {
@@ -27,8 +27,11 @@
27
27
  "blockquote": "cite",
28
28
  "code": "code",
29
29
  "codeblock": "code block",
30
+ "formatClear": "format clear"
31
+ },
32
+ "media": {
30
33
  "link": "external link",
31
- "formatClear": "format clear",
34
+ "image": "image",
32
35
  "tables": {
33
36
  "table": "table",
34
37
  "insertTable": "insert table",
@@ -68,11 +71,22 @@
68
71
  "outdent": "list item outdent"
69
72
  },
70
73
  "dialog": {
71
- "close": "close",
72
74
  "apply": "apply",
75
+ "clear": "clear",
76
+ "close": "close",
77
+ "image": {
78
+ "title": "add/edit image",
79
+ "src": "source",
80
+ "alt": "alt",
81
+ "width": "width",
82
+ "height": "height"
83
+ },
73
84
  "link": {
74
85
  "title": "add/edit link",
75
- "placeholder": "link address"
86
+ "href": "link address",
87
+ "target": "open in new window",
88
+ "rel": "rel",
89
+ "class": "CSS class"
76
90
  },
77
91
  "source": {
78
92
  "title": "view source code",
@@ -21,14 +21,17 @@
21
21
  "underline": "subrayado",
22
22
  "sup": "superíndice",
23
23
  "sub": "subíndice",
24
- "break": "salto de línea",
24
+ "break": "salto forzado",
25
25
  "highlight": "resaltar",
26
26
  "line": "línea horizontal",
27
27
  "blockquote": "cita",
28
28
  "code": "código",
29
29
  "codeblock": "bloque de código",
30
+ "formatClear": "limpiar formato"
31
+ },
32
+ "media": {
30
33
  "link": "enlace externo",
31
- "formatClear": "borrar formato",
34
+ "image": "imagen",
32
35
  "tables": {
33
36
  "table": "tabla",
34
37
  "insertTable": "insertar tabla",
@@ -55,24 +58,35 @@
55
58
  "alignment": "alineación",
56
59
  "alignments": {
57
60
  "left": "alinear a la izquierda",
58
- "center": "centrar",
61
+ "center": "alinear al centro",
59
62
  "right": "alinear a la derecha",
60
63
  "justify": "justificar"
61
64
  },
62
65
  "list": "lista",
63
66
  "lists": {
64
- "bullet": "lista sin orden",
65
- "numbered": "lista numerada",
67
+ "bullet": "lista desordenada",
68
+ "numbered": "lista ordenada",
66
69
  "task": "lista de tareas",
67
- "indent": "sangría de elemento",
68
- "outdent": "reducir sangría"
70
+ "indent": "sangrar elemento de lista",
71
+ "outdent": "reducir sangría de elemento de lista"
69
72
  },
70
73
  "dialog": {
71
- "close": "cerrar",
72
74
  "apply": "aplicar",
75
+ "clear": "limpiar",
76
+ "close": "cerrar",
77
+ "image": {
78
+ "title": "agregar/editar imagen",
79
+ "src": "origen",
80
+ "alt": "alt",
81
+ "width": "ancho",
82
+ "height": "alto"
83
+ },
73
84
  "link": {
74
85
  "title": "agregar/editar enlace",
75
- "placeholder": "dirección del enlace"
86
+ "href": "dirección del enlace",
87
+ "target": "abrir en nueva ventana",
88
+ "rel": "rel",
89
+ "class": "clase css"
76
90
  },
77
91
  "source": {
78
92
  "title": "ver código fuente",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "style": {
3
3
  "paragraph": "paragraphe",
4
- "heading": "titre",
4
+ "heading": "en-tête",
5
5
  "headings": {
6
- "h1": "titre niveau 1",
7
- "h2": "titre niveau 2",
8
- "h3": "titre niveau 3",
9
- "h4": "titre niveau 4",
10
- "h5": "titre niveau 5",
11
- "h6": "titre niveau 6"
6
+ "h1": "en-tête niveau 1",
7
+ "h2": "en-tête niveau 2",
8
+ "h3": "en-tête niveau 3",
9
+ "h4": "en-tête niveau 4",
10
+ "h5": "en-tête niveau 5",
11
+ "h6": "en-tête niveau 6"
12
12
  },
13
13
  "fontFamily": "famille de police",
14
14
  "fontSize": "taille de police",
@@ -21,14 +21,17 @@
21
21
  "underline": "souligné",
22
22
  "sup": "exposant",
23
23
  "sub": "indice",
24
- "break": "saut de ligne",
24
+ "break": "saut forcé",
25
25
  "highlight": "surligner",
26
26
  "line": "ligne horizontale",
27
27
  "blockquote": "citation",
28
28
  "code": "code",
29
29
  "codeblock": "bloc de code",
30
+ "formatClear": "effacer le format"
31
+ },
32
+ "media": {
30
33
  "link": "lien externe",
31
- "formatClear": "effacer le format",
34
+ "image": "image",
32
35
  "tables": {
33
36
  "table": "tableau",
34
37
  "insertTable": "insérer un tableau",
@@ -50,29 +53,40 @@
50
53
  },
51
54
  "action": {
52
55
  "undo": "annuler",
53
- "redo": "rétablir"
56
+ "redo": "refaire"
54
57
  },
55
58
  "alignment": "alignement",
56
59
  "alignments": {
57
60
  "left": "aligner à gauche",
58
- "center": "centrer",
61
+ "center": "aligner au centre",
59
62
  "right": "aligner à droite",
60
63
  "justify": "justifier"
61
64
  },
62
65
  "list": "liste",
63
66
  "lists": {
64
- "bullet": "liste à puces",
65
- "numbered": "liste numérotée",
67
+ "bullet": "liste non ordonnée",
68
+ "numbered": "liste ordonnée",
66
69
  "task": "liste de tâches",
67
- "indent": "retrait d'élément",
68
- "outdent": "réduire le retrait"
70
+ "indent": "indenter l'élément de liste",
71
+ "outdent": "désindenter l'élément de liste"
69
72
  },
70
73
  "dialog": {
71
- "close": "fermer",
72
74
  "apply": "appliquer",
75
+ "clear": "effacer",
76
+ "close": "fermer",
77
+ "image": {
78
+ "title": "ajouter/modifier l'image",
79
+ "src": "source",
80
+ "alt": "alt",
81
+ "width": "largeur",
82
+ "height": "hauteur"
83
+ },
73
84
  "link": {
74
85
  "title": "ajouter/modifier le lien",
75
- "placeholder": "adresse du lien"
86
+ "href": "adresse du lien",
87
+ "target": "ouvrir dans une nouvelle fenêtre",
88
+ "rel": "rel",
89
+ "class": "classe css"
76
90
  },
77
91
  "source": {
78
92
  "title": "voir le code source",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "fontFamily": "famiglia di caratteri",
14
14
  "fontSize": "dimensione carattere",
15
- "lineHeight": "altezza di riga"
15
+ "lineHeight": "altezza riga"
16
16
  },
17
17
  "format": {
18
18
  "bold": "grassetto",
@@ -21,14 +21,17 @@
21
21
  "underline": "sottolineato",
22
22
  "sup": "apice",
23
23
  "sub": "pedice",
24
- "break": "interruzione di riga",
24
+ "break": "interruzione forzata",
25
25
  "highlight": "evidenzia",
26
26
  "line": "linea orizzontale",
27
27
  "blockquote": "citazione",
28
28
  "code": "codice",
29
29
  "codeblock": "blocco di codice",
30
+ "formatClear": "cancella formato"
31
+ },
32
+ "media": {
30
33
  "link": "collegamento esterno",
31
- "formatClear": "cancella formato",
34
+ "image": "immagine",
32
35
  "tables": {
33
36
  "table": "tabella",
34
37
  "insertTable": "inserisci tabella",
@@ -50,29 +53,40 @@
50
53
  },
51
54
  "action": {
52
55
  "undo": "annulla",
53
- "redo": "ripristina"
56
+ "redo": "ripeti"
54
57
  },
55
58
  "alignment": "allineamento",
56
59
  "alignments": {
57
60
  "left": "allinea a sinistra",
58
- "center": "centra",
61
+ "center": "allinea al centro",
59
62
  "right": "allinea a destra",
60
63
  "justify": "giustifica"
61
64
  },
62
65
  "list": "elenco",
63
66
  "lists": {
64
- "bullet": "elenco puntato",
65
- "numbered": "elenco numerato",
67
+ "bullet": "elenco non ordinato",
68
+ "numbered": "elenco ordinato",
66
69
  "task": "elenco attività",
67
- "indent": "rientro elemento",
68
- "outdent": "riduci rientro"
70
+ "indent": "rientra elemento elenco",
71
+ "outdent": "riduci rientro elemento elenco"
69
72
  },
70
73
  "dialog": {
71
- "close": "chiudi",
72
74
  "apply": "applica",
75
+ "clear": "cancella",
76
+ "close": "chiudi",
77
+ "image": {
78
+ "title": "aggiungi/modifica immagine",
79
+ "src": "origine",
80
+ "alt": "alt",
81
+ "width": "larghezza",
82
+ "height": "altezza"
83
+ },
73
84
  "link": {
74
85
  "title": "aggiungi/modifica collegamento",
75
- "placeholder": "indirizzo del collegamento"
86
+ "href": "indirizzo collegamento",
87
+ "target": "apri in nuova finestra",
88
+ "rel": "rel",
89
+ "class": "classe css"
76
90
  },
77
91
  "source": {
78
92
  "title": "visualizza codice sorgente",
@@ -21,14 +21,17 @@
21
21
  "underline": "podkreślenie",
22
22
  "sup": "indeks górny",
23
23
  "sub": "indeks dolny",
24
- "break": "łamanie linii",
25
- "highlight": "podświetlenie",
24
+ "break": "twardy podział",
25
+ "highlight": "wyróżnienie",
26
26
  "line": "linia pozioma",
27
27
  "blockquote": "cytat",
28
28
  "code": "kod",
29
29
  "codeblock": "blok kodu",
30
+ "formatClear": "wyczyść formatowanie"
31
+ },
32
+ "media": {
30
33
  "link": "link zewnętrzny",
31
- "formatClear": "wyczyść formatowanie",
34
+ "image": "obraz",
32
35
  "tables": {
33
36
  "table": "tabela",
34
37
  "insertTable": "wstaw tabelę",
@@ -55,32 +58,43 @@
55
58
  "alignment": "wyrównanie",
56
59
  "alignments": {
57
60
  "left": "wyrównaj do lewej",
58
- "center": "wyśrodkuj",
61
+ "center": "wyrównaj do środka",
59
62
  "right": "wyrównaj do prawej",
60
63
  "justify": "wyjustuj"
61
64
  },
62
65
  "list": "lista",
63
66
  "lists": {
64
- "bullet": "lista punktowana",
65
- "numbered": "lista numerowana",
67
+ "bullet": "lista nieuporządkowana",
68
+ "numbered": "lista uporządkowana",
66
69
  "task": "lista zadań",
67
- "indent": "wcięcie elementu",
68
- "outdent": "zmniejsz wcięcie"
70
+ "indent": "wcięcie elementu listy",
71
+ "outdent": "zmniejsz wcięcie elementu listy"
69
72
  },
70
73
  "dialog": {
71
- "close": "zamknij",
72
74
  "apply": "zastosuj",
75
+ "clear": "wyczyść",
76
+ "close": "zamknij",
77
+ "image": {
78
+ "title": "dodaj/edytuj obraz",
79
+ "src": "źródło",
80
+ "alt": "alt",
81
+ "width": "szerokość",
82
+ "height": "wysokość"
83
+ },
73
84
  "link": {
74
85
  "title": "dodaj/edytuj link",
75
- "placeholder": "adres linku"
86
+ "href": "adres linku",
87
+ "target": "otwórz w nowym oknie",
88
+ "rel": "rel",
89
+ "class": "klasa css"
76
90
  },
77
91
  "source": {
78
- "title": "wyświetl kod źródłowy",
79
- "prettify": "sformatuj"
92
+ "title": "pokaż kod źródłowy",
93
+ "prettify": "upiększ"
80
94
  }
81
95
  },
82
96
  "misc": {
83
- "source": "wyświetl kod źródłowy",
97
+ "source": "pokaż kod źródłowy",
84
98
  "preview": "podgląd"
85
99
  }
86
100
  }
@@ -27,8 +27,11 @@
27
27
  "blockquote": "цитата",
28
28
  "code": "код",
29
29
  "codeblock": "блок кода",
30
+ "formatClear": "очистить форматирование"
31
+ },
32
+ "media": {
30
33
  "link": "внешняя ссылка",
31
- "formatClear": "очистить форматирование",
34
+ "image": "изображение",
32
35
  "tables": {
33
36
  "table": "таблица",
34
37
  "insertTable": "вставить таблицу",
@@ -69,10 +72,21 @@
69
72
  },
70
73
  "dialog": {
71
74
  "apply": "применить",
75
+ "clear": "очистить",
72
76
  "close": "закрыть",
77
+ "image": {
78
+ "title": "добавление/изменение изображения",
79
+ "src": "источник",
80
+ "alt": "alt",
81
+ "width": "ширина",
82
+ "height": "высота"
83
+ },
73
84
  "link": {
74
85
  "title": "добавление/изменение ссылки",
75
- "placeholder": "адрес ссылки"
86
+ "href": "адрес ссылки",
87
+ "target": "открывать в новом окне",
88
+ "rel": "rel",
89
+ "class": "CSS класс"
76
90
  },
77
91
  "source": {
78
92
  "title": "просмотр исходного кода",
@@ -27,8 +27,11 @@
27
27
  "blockquote": "цитата",
28
28
  "code": "код",
29
29
  "codeblock": "блок коду",
30
+ "formatClear": "очистити форматування"
31
+ },
32
+ "media": {
30
33
  "link": "зовнішнє посилання",
31
- "formatClear": "очистити форматування",
34
+ "image": "зображення",
32
35
  "tables": {
33
36
  "table": "таблиця",
34
37
  "insertTable": "вставити таблицю",
@@ -69,10 +72,21 @@
69
72
  },
70
73
  "dialog": {
71
74
  "apply": "застосувати",
75
+ "clear": "очистити",
72
76
  "close": "закрити",
77
+ "image": {
78
+ "title": "додавання/зміна зображення",
79
+ "src": "джерело",
80
+ "alt": "alt",
81
+ "width": "ширина",
82
+ "height": "висота"
83
+ },
73
84
  "link": {
74
85
  "title": "додавання/зміна посилання",
75
- "placeholder": "адреса посилання"
86
+ "href": "адреса посилання",
87
+ "target": "відкривати у новому вікні",
88
+ "rel": "rel",
89
+ "class": "CSS клас"
76
90
  },
77
91
  "source": {
78
92
  "title": "перегляд вихідного коду",