@searpent/react-image-annotate 2.3.0-cand-2 → 2.3.0-cand-3

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.
@@ -611,7 +611,7 @@ var examplePhotos = [{
611
611
  "Y1": 0.38327134,
612
612
  "Y2": 0.5264345
613
613
  },
614
- "text": "[{\"label\":\"text\",\"text\":\"Vedle domácíhhhhhhh špičky nebude chybět řada účastníků OH v Tokiu, nad plánovanou účastí dvojnásobné vítězky Venduly Frintové visí otazník. Nejlepší česká triatlonistka měla žaludeční problémy a o jejím startu se rozhodne na poslední chvíli. Vedle Frintové je přihlášena i druhá česká olympionička Petra Kuříková, jejímž karlovarským maximem je předloňské čtvrté místo. Mezi devítkou domácích závodníků je též Jan Čelůstka i nadějní Tereza Zimovjanová (na snímku) s Radimem Grebíkem.\"}]",
614
+ "text": "[{\"label\":\"text\",\"text\":\"Konec vedddlké opravy. Přinesla také teplejší vodu v bazénu. Vedle domácíhhhhhhh špičky nebude chybět řada účastníků OH v Tokiu, nad plánovanou účastí dvojnásobné vítězky Venduly Frintové visí otazník. Nejlepší česká triatlonistka měla žaludeční problémy a o jejím startu se rozhodne na poslední chvíli. Vedle Frintové je přihlášena i druhá česká olympionička Petra Kuříková, jejímž karlovarským maximem je předloňské čtvrté místo. Mezi devítkou domácích závodníků je též Jan Čelůstka i nadějní Tereza Zimovjanová (na snímku) s Radimem Grebíkem.\"}]",
615
615
  "groupId": "4",
616
616
  "id": "346807505487134722"
617
617
  }, {
package/Editor/editor.css CHANGED
@@ -1,8 +1,8 @@
1
1
  .editor-toggle-wrapper {
2
2
  display: flex;
3
- flex-direction: column;
3
+ flex-direction: row;
4
4
  align-items: flex-start;
5
- gap: 0.5rem; /* space between Spellcheck and Edit mode rows */
5
+ gap: 1rem; /* space between Spellcheck and Edit mode toggles */
6
6
  }
7
7
 
8
8
  /* Smaller toggle size only for Editor switches */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searpent/react-image-annotate",
3
- "version": "2.3.0-cand-2",
3
+ "version": "2.3.0-cand-3",
4
4
  "dependencies": {
5
5
  "@editorjs/editorjs": "^2.25.0",
6
6
  "@editorjs/paragraph": "^2.8.0",
@@ -408,6 +408,7 @@ function _findMisspellings() {
408
408
  _step2,
409
409
  w,
410
410
  word,
411
+ isCorrect,
411
412
  _args3 = arguments;
412
413
 
413
414
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -459,7 +460,18 @@ function _findMisspellings() {
459
460
  // Word extraction across common Latin + Cyrillic ranges
460
461
  // Matches sequences of letters, allowing internal apostrophes/dashes.
461
462
  // Note: Avoids Unicode property escapes (\p{L}) for compatibility with older Babel toolchain.
462
- wordRegex = /[A-Za-zÀ-ÖØ-öø-ÿЀ-ӿ][A-Za-zÀ-ÖØ-öø-ÿЀ-ӿ'’-]*/g;
463
+ //
464
+ // Character coverage by language:
465
+ // - English (en-US): A-Za-z (Basic Latin)
466
+ // - Czech (cs-CZ): A-Za-z + À-ÿ (Latin-1) + \u0100-\u017F (Latin Extended-A: č, ř, š, ž, ě, ů, ď, ť, ň)
467
+ // - Slovak (sk-SK): A-Za-z + À-ÿ (Latin-1: á, é, í, ó, ú, ý, ä, ô) + \u0100-\u017F (Latin Extended-A: č, ď, ň, š, ť, ž, ĺ, ľ, ŕ)
468
+ // - Portuguese (pt-BR): A-Za-z + À-ÿ (Latin-1: á, à, â, ã, ä, é, ê, ë, í, î, ï, ó, ô, õ, ö, ú, û, ü, ç)
469
+ // - Macedonian (mk-MK): Ѐ-ӿ (Cyrillic: all Cyrillic characters including ѓ, ќ, ѕ, џ, ј)
470
+ //
471
+ // IMPORTANT: Latin Extended-A (U+0100-U+017F) was missing in a previous version, causing:
472
+ // - Czech/Slovak words starting with these characters (like "Přinesla") to be incorrectly marked as misspelled
473
+ // - Words containing them (like "vedddlké") to not be extracted properly for spellchecking
474
+ wordRegex = /[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017FЀ-ӿ][A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017FЀ-ӿ'’-]*/g;
463
475
  words = text.match(wordRegex) || [];
464
476
  miss = new Set();
465
477
  _iteratorNormalCompletion2 = true;
@@ -470,7 +482,7 @@ function _findMisspellings() {
470
482
 
471
483
  case 24:
472
484
  if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
473
- _context3.next = 33;
485
+ _context3.next = 34;
474
486
  break;
475
487
  }
476
488
 
@@ -482,66 +494,72 @@ function _findMisspellings() {
482
494
  break;
483
495
  }
484
496
 
485
- return _context3.abrupt("continue", 30);
497
+ return _context3.abrupt("continue", 31);
486
498
 
487
499
  case 29:
488
- if (!spell.correct(word)) miss.add(word);
500
+ isCorrect = spell.correct(word);
489
501
 
490
- case 30:
502
+ if (!isCorrect) {
503
+ miss.add(word); // Debug logging for misspelled words
504
+
505
+ console.log("[Spellcheck] Misspelled word detected: \"".concat(word, "\" (original: \"").concat(w, "\")"));
506
+ }
507
+
508
+ case 31:
491
509
  _iteratorNormalCompletion2 = true;
492
510
  _context3.next = 24;
493
511
  break;
494
512
 
495
- case 33:
496
- _context3.next = 39;
513
+ case 34:
514
+ _context3.next = 40;
497
515
  break;
498
516
 
499
- case 35:
500
- _context3.prev = 35;
517
+ case 36:
518
+ _context3.prev = 36;
501
519
  _context3.t0 = _context3["catch"](22);
502
520
  _didIteratorError2 = true;
503
521
  _iteratorError2 = _context3.t0;
504
522
 
505
- case 39:
506
- _context3.prev = 39;
523
+ case 40:
507
524
  _context3.prev = 40;
525
+ _context3.prev = 41;
508
526
 
509
527
  if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
510
528
  _iterator2.return();
511
529
  }
512
530
 
513
- case 42:
514
- _context3.prev = 42;
531
+ case 43:
532
+ _context3.prev = 43;
515
533
 
516
534
  if (!_didIteratorError2) {
517
- _context3.next = 45;
535
+ _context3.next = 46;
518
536
  break;
519
537
  }
520
538
 
521
539
  throw _iteratorError2;
522
540
 
523
- case 45:
524
- return _context3.finish(42);
525
-
526
541
  case 46:
527
- return _context3.finish(39);
542
+ return _context3.finish(43);
528
543
 
529
544
  case 47:
545
+ return _context3.finish(40);
546
+
547
+ case 48:
530
548
  return _context3.abrupt("return", Array.from(miss));
531
549
 
532
- case 50:
533
- _context3.prev = 50;
550
+ case 51:
551
+ _context3.prev = 51;
534
552
  _context3.t1 = _context3["catch"](3);
535
553
  console.error("[Spellcheck Error] Spellcheck failed for language ".concat(lang, ":"), _context3.t1);
536
554
  console.error("[Spellcheck Error] Stack:", _context3.t1.stack);
537
555
  return _context3.abrupt("return", []);
538
556
 
539
- case 55:
557
+ case 56:
540
558
  case "end":
541
559
  return _context3.stop();
542
560
  }
543
561
  }
544
- }, _callee3, null, [[3, 50], [22, 35, 39, 47], [40,, 42, 46]]);
562
+ }, _callee3, null, [[3, 51], [22, 36, 40, 48], [41,, 43, 47]]);
545
563
  }));
546
564
  return _findMisspellings.apply(this, arguments);
547
565
  }
@@ -635,8 +653,9 @@ function _highlightMisspellingsInHtml() {
635
653
  try {
636
654
  for (var _iterator3 = miss[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
637
655
  var m = _step3.value;
638
- // Use word boundaries instead of Unicode property escapes for compatibility
639
- var re = new RegExp("\\b".concat(escapeRegExp(m), "\\b"), 'gi');
656
+ // Use Unicode-aware word boundary pattern to support accented characters
657
+ // Standard \b doesn't work well with Unicode characters like é, č, ř, etc.
658
+ var re = createUnicodeWordBoundaryRegex(m);
640
659
  out = out.replace(re, "<span class=\"spell-error\">$&</span>");
641
660
  }
642
661
  } catch (err) {
@@ -676,4 +695,17 @@ function _highlightMisspellingsInHtml() {
676
695
 
677
696
  function escapeRegExp(s) {
678
697
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
698
+ } // Create a Unicode-aware word boundary pattern
699
+ // This works better than \b for Unicode characters like é, č, ř, etc.
700
+
701
+
702
+ function createUnicodeWordBoundaryRegex(word) {
703
+ // Escape special regex characters in the word
704
+ var escaped = escapeRegExp(word); // Use a pattern that matches word boundaries with Unicode support
705
+ // Matches: start of string, non-word-char, or word-char before the word
706
+ // And: end of string, non-word-char, or word-char after the word
707
+ // The (?<=...) and (?=...) are lookbehind/lookahead assertions
708
+ // We use [^A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017FЀ-ӿ] to match non-word characters
709
+
710
+ return new RegExp("(?<=^|[^A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\\u0100-\\u017F\u0400-\u04FF])".concat(escaped, "(?=[^A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\\u0100-\\u017F\u0400-\u04FF]|$)"), 'giu');
679
711
  }