@flogeez/angular-tiptap-editor 3.2.1 → 3.3.0

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.
@@ -119,28 +119,29 @@ const AteResizableImage = Node$1.create({
119
119
  },
120
120
  addNodeView() {
121
121
  return ({ node, getPos, editor }) => {
122
+ let currentNode = node;
122
123
  const wrapper = document.createElement("div");
123
124
  wrapper.className = "resizable-image-wrapper";
124
125
  wrapper.style.display = "block";
125
- if (node.attrs["textAlign"]) {
126
- wrapper.style.textAlign = node.attrs["textAlign"];
127
- wrapper.setAttribute("data-align", node.attrs["textAlign"]);
126
+ if (currentNode.attrs["textAlign"]) {
127
+ wrapper.style.textAlign = currentNode.attrs["textAlign"];
128
+ wrapper.setAttribute("data-align", currentNode.attrs["textAlign"]);
128
129
  }
129
130
  const container = document.createElement("div");
130
131
  container.className = "resizable-image-container";
131
132
  container.style.position = "relative";
132
133
  container.style.display = "inline-block";
133
134
  const img = document.createElement("img");
134
- img.src = node.attrs["src"];
135
- img.alt = node.attrs["alt"] || "";
136
- img.title = node.attrs["title"] || "";
135
+ img.src = currentNode.attrs["src"];
136
+ img.alt = currentNode.attrs["alt"] || "";
137
+ img.title = currentNode.attrs["title"] || "";
137
138
  img.className = "ate-image";
138
139
  img.style.display = "inline-block"; // Ensure it respects container text-align
139
- if (node.attrs["width"]) {
140
- img.width = node.attrs["width"];
140
+ if (currentNode.attrs["width"]) {
141
+ img.width = currentNode.attrs["width"];
141
142
  }
142
- if (node.attrs["height"]) {
143
- img.height = node.attrs["height"];
143
+ if (currentNode.attrs["height"]) {
144
+ img.height = currentNode.attrs["height"];
144
145
  }
145
146
  wrapper.appendChild(container);
146
147
  container.appendChild(img);
@@ -187,9 +188,13 @@ const AteResizableImage = Node$1.create({
187
188
  startX = e.clientX;
188
189
  // Use current image dimensions instead of initial ones
189
190
  startWidth =
190
- parseInt(img.getAttribute("width") || "0") || node.attrs["width"] || img.naturalWidth;
191
+ parseInt(img.getAttribute("width") || "0") ||
192
+ currentNode.attrs["width"] ||
193
+ img.naturalWidth;
191
194
  startHeight =
192
- parseInt(img.getAttribute("height") || "0") || node.attrs["height"] || img.naturalHeight;
195
+ parseInt(img.getAttribute("height") || "0") ||
196
+ currentNode.attrs["height"] ||
197
+ img.naturalHeight;
193
198
  // Add resizing class to body
194
199
  document.body.classList.add("resizing");
195
200
  const handleMouseMove = (e) => {
@@ -227,7 +232,7 @@ const AteResizableImage = Node$1.create({
227
232
  const finalHeight = parseInt(img.getAttribute("height") || "0");
228
233
  if (finalWidth && finalHeight) {
229
234
  editor.view.dispatch(editor.view.state.tr.setNodeMarkup(pos, undefined, {
230
- ...node.attrs,
235
+ ...currentNode.attrs,
231
236
  width: finalWidth,
232
237
  height: finalHeight,
233
238
  }));
@@ -268,6 +273,7 @@ const AteResizableImage = Node$1.create({
268
273
  if (updatedNode.type.name !== "resizableImage") {
269
274
  return false;
270
275
  }
276
+ currentNode = updatedNode;
271
277
  img.src = updatedNode.attrs["src"];
272
278
  img.alt = updatedNode.attrs["alt"] || "";
273
279
  img.title = updatedNode.attrs["title"] || "";
@@ -1070,7 +1076,9 @@ const ENGLISH_TRANSLATIONS = {
1070
1076
  editor: {
1071
1077
  placeholder: "Start typing...",
1072
1078
  character: "character",
1079
+ characterPlural: "characters",
1073
1080
  word: "word",
1081
+ wordPlural: "words",
1074
1082
  linkPrompt: "Enter link URL",
1075
1083
  linkUrlPrompt: "Enter URL",
1076
1084
  confirmDelete: "Are you sure you want to delete this?",
@@ -1104,6 +1112,7 @@ const ENGLISH_TRANSLATIONS = {
1104
1112
  copiedSuccess: "Copied to clipboard!",
1105
1113
  },
1106
1114
  };
1115
+
1107
1116
  const FRENCH_TRANSLATIONS = {
1108
1117
  toolbar: {
1109
1118
  bold: "Gras\nCtrl+B",
@@ -1256,7 +1265,9 @@ const FRENCH_TRANSLATIONS = {
1256
1265
  editor: {
1257
1266
  placeholder: "Commencez à écrire...",
1258
1267
  character: "caractère",
1268
+ characterPlural: "caractères",
1259
1269
  word: "mot",
1270
+ wordPlural: "mots",
1260
1271
  linkPrompt: "Entrez l'URL du lien",
1261
1272
  linkUrlPrompt: "Entrez l'URL",
1262
1273
  confirmDelete: "Êtes-vous sûr de vouloir supprimer ceci ?",
@@ -1290,18 +1301,209 @@ const FRENCH_TRANSLATIONS = {
1290
1301
  copiedSuccess: "Copié dans le presse-papiers !",
1291
1302
  },
1292
1303
  };
1304
+
1305
+ const GERMAN_TRANSLATIONS = {
1306
+ toolbar: {
1307
+ bold: "Fett\nStrg+B",
1308
+ italic: "Kursiv\nStrg+I",
1309
+ underline: "Unterstrichen\nStrg+U",
1310
+ strike: "Durchgestrichen\nStrg+Shift+X",
1311
+ code: "Inline-Code\nStrg+E",
1312
+ codeBlock: "Codeblock",
1313
+ superscript: "Hochgestellt",
1314
+ subscript: "Tiefgestellt",
1315
+ highlight: "Hervorheben",
1316
+ highlightPicker: "Hintergrundfarbe",
1317
+ heading1: "Überschrift 1",
1318
+ heading2: "Überschrift 2",
1319
+ heading3: "Überschrift 3",
1320
+ bulletList: "Aufzählungsliste",
1321
+ orderedList: "Nummerierte Liste",
1322
+ blockquote: "Zitatblock",
1323
+ alignLeft: "Links ausrichten",
1324
+ alignCenter: "Zentrieren",
1325
+ alignRight: "Rechts ausrichten",
1326
+ alignJustify: "Blocksatz",
1327
+ link: "Link hinzufügen",
1328
+ image: "Bild hinzufügen",
1329
+ horizontalRule: "Horizontale Linie",
1330
+ table: "Tabelle einfügen",
1331
+ undo: "Rückgängig\nStrg+Z",
1332
+ redo: "Wiederholen\nStrg+Shift+Z",
1333
+ clear: "Leeren",
1334
+ textColor: "Textfarbe",
1335
+ customColor: "Benutzerdefinierte Farbe",
1336
+ presets: "Voreinstellungen",
1337
+ },
1338
+ bubbleMenu: {
1339
+ bold: "Fett\nStrg+B",
1340
+ italic: "Kursiv\nStrg+I",
1341
+ underline: "Unterstrichen\nStrg+U",
1342
+ strike: "Durchgestrichen\nStrg+Shift+X",
1343
+ code: "Code\nStrg+E",
1344
+ superscript: "Hochgestellt",
1345
+ subscript: "Tiefgestellt",
1346
+ highlight: "Hervorheben",
1347
+ highlightPicker: "Hintergrundfarbe",
1348
+ textColor: "Textfarbe",
1349
+ link: "Link",
1350
+ addLink: "Link hinzufügen",
1351
+ editLink: "Link bearbeiten",
1352
+ removeLink: "Link entfernen",
1353
+ linkUrl: "Link-URL",
1354
+ linkText: "Link-Text",
1355
+ openLink: "Link öffnen",
1356
+ customColor: "Benutzerdefinierte Farbe",
1357
+ presets: "Voreinstellungen",
1358
+ },
1359
+ slashCommands: {
1360
+ heading1: {
1361
+ title: "Überschrift 1",
1362
+ description: "Große Abschnittsüberschrift",
1363
+ keywords: ["überschrift", "heading", "h1", "titel", "1", "header"],
1364
+ },
1365
+ heading2: {
1366
+ title: "Überschrift 2",
1367
+ description: "Mittlere Abschnittsüberschrift",
1368
+ keywords: ["überschrift", "heading", "h2", "titel", "2", "header"],
1369
+ },
1370
+ heading3: {
1371
+ title: "Überschrift 3",
1372
+ description: "Kleine Abschnittsüberschrift",
1373
+ keywords: ["überschrift", "heading", "h3", "titel", "3", "header"],
1374
+ },
1375
+ bulletList: {
1376
+ title: "Aufzählungsliste",
1377
+ description: "Eine Aufzählungsliste erstellen",
1378
+ keywords: ["aufzählung", "liste", "bullet", "ul", "unordered"],
1379
+ },
1380
+ orderedList: {
1381
+ title: "Nummerierte Liste",
1382
+ description: "Eine nummerierte Liste erstellen",
1383
+ keywords: ["nummeriert", "liste", "ordered", "ol", "zahlen"],
1384
+ },
1385
+ blockquote: {
1386
+ title: "Zitatblock",
1387
+ description: "Einen Zitatblock hinzufügen",
1388
+ keywords: ["zitat", "blockquote", "quote", "citation"],
1389
+ },
1390
+ code: {
1391
+ title: "Codeblock",
1392
+ description: "Einen Codeblock hinzufügen",
1393
+ keywords: ["code", "codeblock", "pre", "programmierung"],
1394
+ },
1395
+ image: {
1396
+ title: "Bild",
1397
+ description: "Ein Bild einfügen",
1398
+ keywords: ["bild", "image", "foto", "photo", "picture", "img"],
1399
+ },
1400
+ horizontalRule: {
1401
+ title: "Horizontale Linie",
1402
+ description: "Eine horizontale Trennlinie hinzufügen",
1403
+ keywords: ["linie", "horizontal", "rule", "hr", "trennlinie", "separator"],
1404
+ },
1405
+ table: {
1406
+ title: "Tabelle",
1407
+ description: "Eine Tabelle einfügen",
1408
+ keywords: ["tabelle", "table", "grid", "raster", "daten", "zeilen", "spalten"],
1409
+ },
1410
+ },
1411
+ table: {
1412
+ addRowBefore: "Zeile davor einfügen",
1413
+ addRowAfter: "Zeile danach einfügen",
1414
+ deleteRow: "Zeile löschen",
1415
+ addColumnBefore: "Spalte davor einfügen",
1416
+ addColumnAfter: "Spalte danach einfügen",
1417
+ deleteColumn: "Spalte löschen",
1418
+ deleteTable: "Tabelle löschen",
1419
+ toggleHeaderRow: "Kopfzeile umschalten",
1420
+ toggleHeaderColumn: "Kopfspalte umschalten",
1421
+ mergeCells: "Zellen verbinden",
1422
+ splitCell: "Zelle teilen",
1423
+ },
1424
+ imageUpload: {
1425
+ selectImage: "Bild auswählen",
1426
+ loadError: "Fehler beim Laden des Bildes",
1427
+ uploadingImage: "Bild wird hochgeladen...",
1428
+ uploadProgress: "Upload-Fortschritt",
1429
+ uploadError: "Upload-Fehler",
1430
+ uploadSuccess: "Upload erfolgreich",
1431
+ imageTooLarge: "Bild ist zu groß",
1432
+ invalidFileType: "Ungültiger Dateityp",
1433
+ dragDropText: "Bilder hierher ziehen und ablegen",
1434
+ changeImage: "Bild ändern",
1435
+ downloadImage: "Bild herunterladen",
1436
+ deleteImage: "Bild löschen",
1437
+ resizeSmall: "Klein",
1438
+ resizeMedium: "Mittel",
1439
+ resizeLarge: "Groß",
1440
+ resizeOriginal: "Originalgröße",
1441
+ alignLeft: "Links ausrichten",
1442
+ alignCenter: "Zentrieren",
1443
+ alignRight: "Rechts ausrichten",
1444
+ resizing: "Größe wird angepasst...",
1445
+ compressing: "Bild wird komprimiert...",
1446
+ compressionError: "Fehler bei der Komprimierung",
1447
+ validating: "Datei wird geprüft...",
1448
+ uploadingToServer: "Upload zum Server...",
1449
+ replacingImage: "Bild wird ersetzt...",
1450
+ insertingImage: "Bild wird in den Editor eingefügt...",
1451
+ noFileSelected: "Keine Bilddatei ausgewählt",
1452
+ selectionCancelled: "Auswahl abgebrochen",
1453
+ },
1454
+ editor: {
1455
+ placeholder: "Beginne zu schreiben...",
1456
+ character: "Zeichen",
1457
+ characterPlural: "Zeichen",
1458
+ word: "Wort",
1459
+ wordPlural: "Wörter",
1460
+ linkPrompt: "Link-URL eingeben",
1461
+ linkUrlPrompt: "URL eingeben",
1462
+ confirmDelete: "Möchtest du dies wirklich löschen?",
1463
+ toggleEdit: "In den Bearbeitungsmodus wechseln",
1464
+ viewMode: "In den Ansichtsmodus wechseln",
1465
+ blockAdd: "Klicken, um einen Block hinzuzufügen",
1466
+ blockDrag: "Ziehen, um diesen Block zu verschieben",
1467
+ },
1468
+ common: {
1469
+ cancel: "Abbrechen",
1470
+ confirm: "Bestätigen",
1471
+ apply: "Anwenden",
1472
+ delete: "Löschen",
1473
+ save: "Speichern",
1474
+ close: "Schließen",
1475
+ loading: "Lädt",
1476
+ error: "Fehler",
1477
+ success: "Erfolg",
1478
+ },
1479
+ export: {
1480
+ export: "Exportieren",
1481
+ html: "HTML",
1482
+ markdown: "Markdown",
1483
+ text: "Nur Text",
1484
+ copyHtml: "Als HTML kopieren",
1485
+ copyMarkdown: "Als Markdown kopieren",
1486
+ copyText: "Als reinen Text kopieren",
1487
+ downloadHtml: ".html herunterladen",
1488
+ downloadMarkdown: ".md herunterladen",
1489
+ downloadText: ".txt herunterladen",
1490
+ copiedSuccess: "In die Zwischenablage kopiert!",
1491
+ },
1492
+ };
1493
+
1293
1494
  class AteI18nService {
1294
1495
  constructor() {
1295
1496
  this._currentLocale = signal("en");
1296
1497
  this._translations = signal({
1297
1498
  en: ENGLISH_TRANSLATIONS,
1298
1499
  fr: FRENCH_TRANSLATIONS,
1500
+ de: GERMAN_TRANSLATIONS,
1299
1501
  });
1300
1502
  // Public signals
1301
1503
  this.currentLocale = this._currentLocale.asReadonly();
1302
1504
  /** All loaded translations (useful for dynamic key access) */
1303
1505
  this.allTranslations = this._translations.asReadonly();
1304
- this.translations = computed(() => this._translations()[this._currentLocale()]);
1506
+ this.translations = computed(() => this._translations()[this._currentLocale()] ?? this._translations().en);
1305
1507
  // Fast translation methods
1306
1508
  this.t = computed(() => this.translations());
1307
1509
  this.toolbar = computed(() => this.translations().toolbar);
@@ -8516,7 +8718,7 @@ class AngularTiptapEditorComponent {
8516
8718
  [class.limit-reached]="finalMaxCharacters() && characterCount() >= finalMaxCharacters()!">
8517
8719
  @if (finalShowCharacterCount()) {
8518
8720
  {{ characterCount() }}
8519
- {{ currentTranslations().editor.character }}{{ characterCount() > 1 ? "s" : "" }}
8721
+ {{ characterCount() > 1 ? currentTranslations().editor.characterPlural : currentTranslations().editor.character }}
8520
8722
  @if (finalMaxCharacters()) {
8521
8723
  / {{ finalMaxCharacters() }}
8522
8724
  }
@@ -8528,7 +8730,7 @@ class AngularTiptapEditorComponent {
8528
8730
 
8529
8731
  @if (finalShowWordCount()) {
8530
8732
  {{ wordCount() }}
8531
- {{ currentTranslations().editor.word }}{{ wordCount() > 1 ? "s" : "" }}
8733
+ {{ wordCount() > 1 ? currentTranslations().editor.wordPlural : currentTranslations().editor.word }}
8532
8734
  }
8533
8735
  </div>
8534
8736
  }
@@ -8677,7 +8879,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
8677
8879
  [class.limit-reached]="finalMaxCharacters() && characterCount() >= finalMaxCharacters()!">
8678
8880
  @if (finalShowCharacterCount()) {
8679
8881
  {{ characterCount() }}
8680
- {{ currentTranslations().editor.character }}{{ characterCount() > 1 ? "s" : "" }}
8882
+ {{ characterCount() > 1 ? currentTranslations().editor.characterPlural : currentTranslations().editor.character }}
8681
8883
  @if (finalMaxCharacters()) {
8682
8884
  / {{ finalMaxCharacters() }}
8683
8885
  }
@@ -8689,7 +8891,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
8689
8891
 
8690
8892
  @if (finalShowWordCount()) {
8691
8893
  {{ wordCount() }}
8692
- {{ currentTranslations().editor.word }}{{ wordCount() > 1 ? "s" : "" }}
8894
+ {{ wordCount() > 1 ? currentTranslations().editor.wordPlural : currentTranslations().editor.word }}
8693
8895
  }
8694
8896
  </div>
8695
8897
  }