@brandup/ui-textbox 1.0.40 → 1.0.41

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
@@ -24,15 +24,15 @@
24
24
  "email": "it@brandup.online"
25
25
  },
26
26
  "license": "Apache-2.0",
27
- "version": "1.0.40",
27
+ "version": "1.0.41",
28
28
  "main": "source/index.ts",
29
29
  "types": "source/index.ts",
30
30
  "dependencies": {
31
31
  "@brandup/ui": "^2.0.7",
32
32
  "@brandup/ui-helpers": "^2.0.7",
33
- "@brandup/ui-input": "^1.0.40",
34
- "@brandup/ui-kit": "^1.0.40",
35
- "@brandup/ui-richeditor": "^1.0.40"
33
+ "@brandup/ui-input": "^1.0.41",
34
+ "@brandup/ui-kit": "^1.0.41",
35
+ "@brandup/ui-richeditor": "^1.0.41"
36
36
  },
37
37
  "files": [
38
38
  "source",
@@ -49,26 +49,7 @@
49
49
  z-index: 2;
50
50
  margin-right: 5px;
51
51
  padding-right: calc(var(--input-padding-lr) - 5px);
52
- scrollbar-width: 6px;
53
- overflow-y: auto;
54
-
55
- &::-webkit-scrollbar {
56
- width: 6px;
57
- background: none;
58
- }
59
-
60
- &::-webkit-scrollbar-track {
61
- border-radius: 3px;
62
- background-color: transparent;
63
- margin: 6px 0;
64
- cursor: default;
65
- }
66
-
67
- &::-webkit-scrollbar-thumb {
68
- background-color: #8696a0;
69
- border-radius: 3px;
70
- cursor: default;
71
- }
52
+ overflow-y: auto; // полоса прокрутки — общая, от .ui-scrollable кита
72
53
  }
73
54
 
74
55
  // редактор (@brandup/ui-richeditor) — занимает доступное место; внутреннее оформление в richeditor.less
package/source/textbox.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./textbox.less"; // стили компонента
2
2
 
3
3
  import { InputControl } from "@brandup/ui-input";
4
- import { IS_TOUCH_DEVICE } from "@brandup/ui-kit";
4
+ import { IS_TOUCH_DEVICE, SCROLLABLE_CLASS } from "@brandup/ui-kit";
5
5
  import { DOM } from "@brandup/ui";
6
6
  import { FuncHelper } from "@brandup/ui-helpers";
7
7
  import RichEditor, {
@@ -102,15 +102,16 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
102
102
  // форматирование доступно только для обычного текстового ввода
103
103
  const format = type === "text" && valueElem.hasAttribute("data-format");
104
104
  const formatStorage: FormatStorage =
105
- valueElem.getAttribute("data-format-storage") === "markdown" ? "markdown" : "html";
106
- const formatTools = format ? parseFormatTools(valueElem.getAttribute("data-format-tools")) : [];
105
+ valueElem.dataset.formatStorage === "markdown" ? "markdown" : "html";
106
+ const formatTools = format ? parseFormatTools(valueElem.dataset.formatTools ?? null) : [];
107
107
  // кнопки действий панели (очистка формата, отмена, повтор) — подключаются явно
108
- const editorActions = format ? parseEditorActions(valueElem.getAttribute("data-editor-actions")) : [];
108
+ const editorActions = format ? parseEditorActions(valueElem.dataset.editorActions ?? null) : [];
109
109
 
110
110
  // markdown-маркеры с дефолтами, переопределяются атрибутами data-format-md-<tool>
111
111
  const formatMarkers = defaultFormatMarkers();
112
112
  if (format) {
113
113
  for (const tool of Object.keys(formatMarkers) as FormatTool[]) {
114
+ // имя атрибута собирается на ходу: у dataset оно потребовало бы ручного camelCase
114
115
  const marker = valueElem.getAttribute(`data-format-md-${tool}`)?.trim();
115
116
  if (marker) formatMarkers[tool] = marker;
116
117
  }
@@ -122,7 +123,7 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
122
123
 
123
124
  const container = DOM.tag("div", { class: ROOT_CLASS }, [
124
125
  DOM.tag("div", { class: "decorator" }),
125
- DOM.tag("div", { class: "editor" }, [inputElem, symbolsCountElem]),
126
+ DOM.tag("div", { class: ["editor", SCROLLABLE_CLASS] }, [inputElem, symbolsCountElem]),
126
127
  actionsElem,
127
128
  ]);
128
129
 
@@ -139,7 +140,7 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
139
140
  // команда объявляется атрибутом data-command — по нему её ищет обработчик @brandup/ui
140
141
  const buttonElem = DOM.tag(
141
142
  "button",
142
- { "data-command": "copy-text", title: "Скопировать в буфер обмена" },
143
+ { command: "copy-text", title: "Скопировать в буфер обмена" },
143
144
  copyIcon
144
145
  );
145
146
  if (disabled) buttonElem.disabled = true;