@brandup/ui-textbox 1.0.41 → 1.0.42
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 +4 -4
- package/source/index.ts +2 -0
- package/source/textbox.ts +5 -2
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.
|
|
27
|
+
"version": "1.0.42",
|
|
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.
|
|
34
|
-
"@brandup/ui-kit": "^1.0.
|
|
35
|
-
"@brandup/ui-richeditor": "^1.0.
|
|
33
|
+
"@brandup/ui-input": "^1.0.42",
|
|
34
|
+
"@brandup/ui-kit": "^1.0.42",
|
|
35
|
+
"@brandup/ui-richeditor": "^1.0.42"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"source",
|
package/source/index.ts
CHANGED
|
@@ -7,10 +7,12 @@ export {
|
|
|
7
7
|
ALL_FORMAT_TOOLS,
|
|
8
8
|
EDITOR_ACTIONS,
|
|
9
9
|
FORMAT_TOOLS,
|
|
10
|
+
parseBlockTypes,
|
|
10
11
|
parseEditorActions,
|
|
11
12
|
parseFormatTools,
|
|
12
13
|
defaultFormatMarkers,
|
|
13
14
|
normalizeWhitespace,
|
|
15
|
+
type BlockType,
|
|
14
16
|
type EditorAction,
|
|
15
17
|
type FormatTool,
|
|
16
18
|
type FormatStorage,
|
package/source/textbox.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { DOM } from "@brandup/ui";
|
|
|
6
6
|
import { FuncHelper } from "@brandup/ui-helpers";
|
|
7
7
|
import RichEditor, {
|
|
8
8
|
defaultFormatMarkers,
|
|
9
|
+
parseBlockTypes,
|
|
9
10
|
parseEditorActions,
|
|
10
11
|
parseFormatTools,
|
|
11
12
|
type FormatMarkers,
|
|
@@ -101,11 +102,12 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
|
|
|
101
102
|
|
|
102
103
|
// форматирование доступно только для обычного текстового ввода
|
|
103
104
|
const format = type === "text" && valueElem.hasAttribute("data-format");
|
|
104
|
-
const formatStorage: FormatStorage =
|
|
105
|
-
valueElem.dataset.formatStorage === "markdown" ? "markdown" : "html";
|
|
105
|
+
const formatStorage: FormatStorage = valueElem.dataset.formatStorage === "markdown" ? "markdown" : "html";
|
|
106
106
|
const formatTools = format ? parseFormatTools(valueElem.dataset.formatTools ?? null) : [];
|
|
107
107
|
// кнопки действий панели (очистка формата, отмена, повтор) — подключаются явно
|
|
108
108
|
const editorActions = format ? parseEditorActions(valueElem.dataset.editorActions ?? null) : [];
|
|
109
|
+
// типы блоков (цитата, блок кода) — тоже явно и только в многострочном поле
|
|
110
|
+
const blocks = parseBlockTypes(multyline ? (valueElem.dataset.blocks ?? null) : null);
|
|
109
111
|
|
|
110
112
|
// markdown-маркеры с дефолтами, переопределяются атрибутами data-format-md-<tool>
|
|
111
113
|
const formatMarkers = defaultFormatMarkers();
|
|
@@ -185,6 +187,7 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
|
|
|
185
187
|
markers: formatMarkers,
|
|
186
188
|
placeholder,
|
|
187
189
|
multiline: multyline,
|
|
190
|
+
blocks,
|
|
188
191
|
readonly,
|
|
189
192
|
// тулбар позиционируется относительно контейнера TextBox (а не document.body)
|
|
190
193
|
toolbarContainer: container,
|