@sequent-org/moodboard 1.4.63 → 1.4.64
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
|
@@ -229,7 +229,10 @@ export function bindTextEditorInteractions(controller, {
|
|
|
229
229
|
|
|
230
230
|
const value = (textarea.value || '').trim();
|
|
231
231
|
if (isNewCreation && value.length === 0) {
|
|
232
|
-
finalize(
|
|
232
|
+
// Записка и фигура остаются на доске пустыми: finalize(true) при пустом
|
|
233
|
+
// значении не коммитит контент, но и не запускает удаление нового объекта
|
|
234
|
+
// (см. shouldDeleteEmptyNewCreation). Для текста — прежнее удаление.
|
|
235
|
+
finalize(isNote || isShape);
|
|
233
236
|
return;
|
|
234
237
|
}
|
|
235
238
|
finalize(true);
|
|
@@ -457,7 +460,10 @@ export function closeTextEditorFromState(controller, commit) {
|
|
|
457
460
|
const properties = controller.textEditor.properties;
|
|
458
461
|
const isNewCreation = controller.textEditor.isNewCreation;
|
|
459
462
|
const initialContent = controller.textEditor.initialContent ?? '';
|
|
460
|
-
|
|
463
|
+
// Записку и фигуру не удаляем при закрытии редактора пустыми (клик вне объекта):
|
|
464
|
+
// элемент должен оставаться на доске даже без текста. Текст — прежнее поведение.
|
|
465
|
+
const shouldDeleteEmptyNewCreation = !commitValue && !!isNewCreation && !!objectId
|
|
466
|
+
&& objectType !== 'note' && objectType !== 'shape';
|
|
461
467
|
|
|
462
468
|
if (objectId) {
|
|
463
469
|
if (typeof window !== 'undefined' && window.moodboardHtmlTextLayer) {
|
|
@@ -527,7 +527,7 @@ export class TextPropertiesPanel {
|
|
|
527
527
|
: getFallbackControlValues();
|
|
528
528
|
|
|
529
529
|
this.fontSelect.value = values.fontFamily;
|
|
530
|
-
this.
|
|
530
|
+
this._setFontSizeValue(values.fontSize);
|
|
531
531
|
this._updateCurrentColorButton(values.color);
|
|
532
532
|
this._updateCurrentHighlightButton(values.highlightColor);
|
|
533
533
|
this._updateCurrentBgColorButton(values.backgroundColor);
|
|
@@ -547,6 +547,45 @@ export class TextPropertiesPanel {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
+
// Нативный <select> отрисовывается пустым, если присвоить ему value, которого
|
|
551
|
+
// нет среди <option> (selectedIndex становится -1). Размер текста после ресайза
|
|
552
|
+
// может выходить за пределы пресет-списка, поэтому для нестандартного значения
|
|
553
|
+
// вставляем временный <option> в позицию по возрастанию — поле всегда показывает
|
|
554
|
+
// фактический размер, а степперы продолжают двигаться по соседним значениям.
|
|
555
|
+
_setFontSizeValue(rawValue) {
|
|
556
|
+
const select = this.fontSizeSelect;
|
|
557
|
+
if (!select) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
const value = String(rawValue);
|
|
562
|
+
|
|
563
|
+
const prevDynamic = select.querySelector('option[data-dynamic="true"]');
|
|
564
|
+
if (prevDynamic) {
|
|
565
|
+
prevDynamic.remove();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const hasOption = Array.from(select.options).some((opt) => opt.value === value);
|
|
569
|
+
if (!hasOption) {
|
|
570
|
+
const option = document.createElement('option');
|
|
571
|
+
option.value = value;
|
|
572
|
+
option.textContent = value;
|
|
573
|
+
option.dataset.dynamic = 'true';
|
|
574
|
+
|
|
575
|
+
const numeric = parseFloat(value);
|
|
576
|
+
const insertBeforeIndex = Array.from(select.options).findIndex(
|
|
577
|
+
(opt) => parseFloat(opt.value) > numeric,
|
|
578
|
+
);
|
|
579
|
+
if (insertBeforeIndex === -1) {
|
|
580
|
+
select.appendChild(option);
|
|
581
|
+
} else {
|
|
582
|
+
select.insertBefore(option, select.options[insertBeforeIndex]);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
select.value = value;
|
|
587
|
+
}
|
|
588
|
+
|
|
550
589
|
reposition() {
|
|
551
590
|
if (!this.panel || !this.currentId || this.panel.style.display === 'none') {
|
|
552
591
|
return;
|
package/src/ui/styles/panels.css
CHANGED
|
@@ -634,7 +634,7 @@
|
|
|
634
634
|
box-sizing: border-box;
|
|
635
635
|
min-width: 70px;
|
|
636
636
|
width: 70px;
|
|
637
|
-
height:
|
|
637
|
+
height: 36px;
|
|
638
638
|
padding: 4px 0px;
|
|
639
639
|
font-size: 13px;
|
|
640
640
|
background-color: #fff;
|
|
@@ -723,7 +723,7 @@
|
|
|
723
723
|
border: none;
|
|
724
724
|
border-radius: 4px;
|
|
725
725
|
background-color: #fff;
|
|
726
|
-
height:
|
|
726
|
+
height: 36px;
|
|
727
727
|
box-sizing: border-box;
|
|
728
728
|
}
|
|
729
729
|
|