@team-monolith/cds 1.10.6 → 1.11.1

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.
Files changed (55) hide show
  1. package/dist/CodleDesignSystemProvider.d.ts +0 -12
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -1
  4. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputComponent.js +24 -15
  5. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SegmentedInput.d.ts +12 -0
  6. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SegmentedInput.js +120 -0
  7. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/TextInput.d.ts +6 -0
  8. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/TextInput.js +28 -0
  9. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox.js +5 -0
  10. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +1 -1
  11. package/package.json +2 -15
  12. package/dist/patterns/ReactEditorJS/Layout.d.ts +0 -8
  13. package/dist/patterns/ReactEditorJS/Layout.js +0 -91
  14. package/dist/patterns/ReactEditorJS/ReactEditorJS.d.ts +0 -15
  15. package/dist/patterns/ReactEditorJS/ReactEditorJS.js +0 -87
  16. package/dist/patterns/ReactEditorJS/customTools/block/Callout.d.ts +0 -38
  17. package/dist/patterns/ReactEditorJS/customTools/block/Callout.js +0 -162
  18. package/dist/patterns/ReactEditorJS/customTools/block/Delimiter.d.ts +0 -10
  19. package/dist/patterns/ReactEditorJS/customTools/block/Delimiter.js +0 -26
  20. package/dist/patterns/ReactEditorJS/customTools/block/Header.d.ts +0 -60
  21. package/dist/patterns/ReactEditorJS/customTools/block/Header.js +0 -122
  22. package/dist/patterns/ReactEditorJS/customTools/block/Image.d.ts +0 -22
  23. package/dist/patterns/ReactEditorJS/customTools/block/Image.js +0 -61
  24. package/dist/patterns/ReactEditorJS/customTools/block/NestedList.d.ts +0 -28
  25. package/dist/patterns/ReactEditorJS/customTools/block/NestedList.js +0 -74
  26. package/dist/patterns/ReactEditorJS/customTools/block/Quote.d.ts +0 -42
  27. package/dist/patterns/ReactEditorJS/customTools/block/Quote.js +0 -171
  28. package/dist/patterns/ReactEditorJS/customTools/block/Raw.d.ts +0 -30
  29. package/dist/patterns/ReactEditorJS/customTools/block/Raw.js +0 -107
  30. package/dist/patterns/ReactEditorJS/customTools/block/Table.d.ts +0 -9
  31. package/dist/patterns/ReactEditorJS/customTools/block/Table.js +0 -28
  32. package/dist/patterns/ReactEditorJS/customTools/index.d.ts +0 -16
  33. package/dist/patterns/ReactEditorJS/customTools/index.js +0 -16
  34. package/dist/patterns/ReactEditorJS/customTools/inline/Bold.d.ts +0 -52
  35. package/dist/patterns/ReactEditorJS/customTools/inline/Bold.js +0 -83
  36. package/dist/patterns/ReactEditorJS/customTools/inline/InlineCode.d.ts +0 -4
  37. package/dist/patterns/ReactEditorJS/customTools/inline/InlineCode.js +0 -7
  38. package/dist/patterns/ReactEditorJS/customTools/inline/Italic.d.ts +0 -48
  39. package/dist/patterns/ReactEditorJS/customTools/inline/Italic.js +0 -79
  40. package/dist/patterns/ReactEditorJS/customTools/inline/StrikeThrough.d.ts +0 -4
  41. package/dist/patterns/ReactEditorJS/customTools/inline/StrikeThrough.js +0 -7
  42. package/dist/patterns/ReactEditorJS/customTools/inline/Underline.d.ts +0 -4
  43. package/dist/patterns/ReactEditorJS/customTools/inline/Underline.js +0 -7
  44. package/dist/patterns/ReactEditorJS/customTools/tunes/Delete.d.ts +0 -30
  45. package/dist/patterns/ReactEditorJS/customTools/tunes/Delete.js +0 -36
  46. package/dist/patterns/ReactEditorJS/customTools/tunes/MoveDown.d.ts +0 -34
  47. package/dist/patterns/ReactEditorJS/customTools/tunes/MoveDown.js +0 -58
  48. package/dist/patterns/ReactEditorJS/customTools/tunes/MoveUp.d.ts +0 -34
  49. package/dist/patterns/ReactEditorJS/customTools/tunes/MoveUp.js +0 -68
  50. package/dist/patterns/ReactEditorJS/i18n.d.ts +0 -128
  51. package/dist/patterns/ReactEditorJS/i18n.js +0 -128
  52. package/dist/patterns/ReactEditorJS/index.d.ts +0 -3
  53. package/dist/patterns/ReactEditorJS/index.js +0 -3
  54. package/dist/patterns/ReactEditorJS/tools.d.ts +0 -80
  55. package/dist/patterns/ReactEditorJS/tools.js +0 -106
@@ -1,171 +0,0 @@
1
- import { doubleQuotesLSvg, inputMethodLineSvg } from "../../../../icons";
2
- import { css } from "@emotion/react";
3
- import { hexToCSSFilter } from "hex-to-css-filter";
4
- export const QuoteStyle = (theme) => css `
5
- .ce-quote {
6
- outline: none;
7
- margin-bottom: 8px;
8
- padding-left: 12px;
9
- border-left: 4px solid ${theme.color.container.marbleContainer};
10
- color: ${theme.color.container.marbleOnContainer};
11
- /* Default/Paragraph/14px-Rg */
12
- font-family: ${theme.fontFamily.ui};
13
- font-size: 14px;
14
- font-style: normal;
15
- font-weight: 400;
16
- line-height: 20px; /* 142.857% */
17
- &.red {
18
- border-left: 4px solid ${theme.color.container.dangerContainer};
19
- color: ${theme.color.container.dangerOnContainer};
20
- }
21
- &.yellow {
22
- border-left: 4px solid ${theme.color.container.warningContainer};
23
- color: ${theme.color.container.warningOnContainer};
24
- }
25
- &.blue {
26
- border-left: 4px solid ${theme.color.container.primaryContainer};
27
- color: ${theme.color.container.primaryOnContainer};
28
- }
29
- &.green {
30
- border-left: 4px solid ${theme.color.container.successContainer};
31
- color: ${theme.color.container.successOnContainer};
32
- }
33
- }
34
- // img태그에서는 color를 사용할 수 없으므로 filter를 사용합니다.
35
- .ce-popover-item[data-item-name="grey"] .ce-popover-item__icon {
36
- background: ${theme.color.container.marbleContainer};
37
- img {
38
- filter: ${hexToCSSFilter(theme.color.container.marbleOnContainer).filter};
39
- }
40
- }
41
- .ce-popover-item[data-item-name="red"] .ce-popover-item__icon {
42
- background: ${theme.color.container.dangerContainer};
43
- img {
44
- filter: ${hexToCSSFilter(theme.color.container.dangerOnContainer).filter};
45
- }
46
- }
47
- .ce-popover-item[data-item-name="yellow"] .ce-popover-item__icon {
48
- background: ${theme.color.container.warningContainer};
49
- img {
50
- filter: ${hexToCSSFilter(theme.color.container.warningOnContainer)
51
- .filter};
52
- }
53
- }
54
- .ce-popover-item[data-item-name="blue"] .ce-popover-item__icon {
55
- background: ${theme.color.container.primaryContainer};
56
- img {
57
- filter: ${hexToCSSFilter(theme.color.container.primaryOnContainer)
58
- .filter};
59
- }
60
- }
61
- .ce-popover-item[data-item-name="green"] .ce-popover-item__icon {
62
- background: ${theme.color.container.successContainer};
63
- img {
64
- filter: ${hexToCSSFilter(theme.color.container.successOnContainer)
65
- .filter};
66
- }
67
- }
68
- `;
69
- export class Quote {
70
- constructor({ api, config, readOnly, data }) {
71
- this.api = api;
72
- this.config = config;
73
- this.readOnly = readOnly;
74
- this._wrapper = this.createWrapper(data);
75
- }
76
- /** 주어진 data에 따라 HTML Element를 반환함. */
77
- createWrapper(data) {
78
- const wrapper = document.createElement("div");
79
- wrapper.classList.add("ce-quote", data.color || this.defaultColor);
80
- wrapper.contentEditable = this.readOnly ? "false" : "true";
81
- wrapper.innerHTML = data.text || "";
82
- return wrapper;
83
- }
84
- /** 주어진 data에 따라 this._wrapper를 업데이트함. */
85
- updateWrapper(data) {
86
- var _a;
87
- const newWrapper = this.createWrapper(data);
88
- (_a = this._wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newWrapper, this._wrapper);
89
- this._wrapper = newWrapper;
90
- }
91
- get colors() {
92
- return ["grey", "red", "yellow", "blue", "green"];
93
- }
94
- get defaultColor() {
95
- return this.colors[0];
96
- }
97
- get color() {
98
- return this._wrapper.classList[1];
99
- }
100
- save() {
101
- var _a;
102
- return {
103
- color: this.color,
104
- text: (_a = this._wrapper.innerHTML) !== null && _a !== void 0 ? _a : "",
105
- };
106
- }
107
- render() {
108
- return this._wrapper;
109
- }
110
- // block tune 설정
111
- renderSettings() {
112
- const tunes = [
113
- {
114
- name: "grey",
115
- label: this.api.i18n.t("Grey"),
116
- },
117
- {
118
- name: "red",
119
- label: this.api.i18n.t("Red"),
120
- },
121
- {
122
- name: "yellow",
123
- label: this.api.i18n.t("Yellow"),
124
- },
125
- {
126
- name: "blue",
127
- label: this.api.i18n.t("Blue"),
128
- },
129
- {
130
- name: "green",
131
- label: this.api.i18n.t("Green"),
132
- },
133
- ];
134
- return tunes.map((tune) => ({
135
- name: tune.name,
136
- icon: `<img src="${inputMethodLineSvg}" />`,
137
- label: tune.label,
138
- isActive: this.color === tune.name,
139
- closeOnActivate: true,
140
- onActivate: () => {
141
- var _a;
142
- this.updateWrapper({
143
- color: tune.name,
144
- text: (_a = this._wrapper.innerHTML) !== null && _a !== void 0 ? _a : "",
145
- });
146
- },
147
- }));
148
- }
149
- static get isReadOnlySupported() {
150
- return true;
151
- }
152
- static get enableLineBreaks() {
153
- return true;
154
- }
155
- static get toolbox() {
156
- return {
157
- icon: `<img src="${doubleQuotesLSvg}" />`,
158
- title: "Quote",
159
- };
160
- }
161
- // TODO: 현재 onPaste 작동하지 않습니다.
162
- onPaste(event) {
163
- const content = event.detail.data;
164
- this._wrapper.innerHTML = content.textContent;
165
- }
166
- static get pasteConfig() {
167
- return {
168
- tags: ["BLOCKQUOTE"],
169
- };
170
- }
171
- }
@@ -1,30 +0,0 @@
1
- import EditorJSRaw from "@editorjs/raw";
2
- import { Theme } from "@emotion/react";
3
- type COLOR_TYPE = "code-light-theme" | "code-dark-theme";
4
- export declare const RawStyle: (theme: Theme) => import("@emotion/utils").SerializedStyles;
5
- export declare class Raw extends EditorJSRaw {
6
- private _color;
7
- constructor({ data, config, api, readOnly }: any);
8
- set color(color: COLOR_TYPE);
9
- get colors(): string[];
10
- get defaultColor(): string;
11
- render(): HTMLElement;
12
- save(rawToolsWrapper: HTMLDivElement): any;
13
- renderSettings(): {
14
- name: string;
15
- icon: string;
16
- label: any;
17
- isActive: boolean;
18
- closeOnActivate: boolean;
19
- onActivate: () => void;
20
- }[];
21
- static get toolbox(): {
22
- icon: string;
23
- title: string;
24
- };
25
- onPaste(event: any): void;
26
- static get pasteConfig(): {
27
- tags: string[];
28
- };
29
- }
30
- export {};
@@ -1,107 +0,0 @@
1
- import EditorJSRaw from "@editorjs/raw";
2
- import { css } from "@emotion/react";
3
- import { codeViewSvg, lightbulbFillSvg, lightbulbLineSvg, } from "../../../../icons";
4
- import { hexToCSSFilter } from "hex-to-css-filter";
5
- export const RawStyle = (theme) => css `
6
- .ce-rawtool__textarea {
7
- border-radius: 6px;
8
- padding: 4px 8px;
9
- color: ${theme.color.foreground.neutralBase};
10
- background-color: ${theme.color.background.neutralAlt};
11
- /* Mono/Paragraph/14px-Rg */
12
- font-family: D2Coding;
13
- font-size: 14px;
14
- font-style: normal;
15
- font-weight: 400;
16
- line-height: 20px; /* 142.857% */
17
- &.code-dark-theme {
18
- color: ${theme.color.container.obsidianOnContainer};
19
- background-color: ${theme.color.container.obsidianContainer};
20
- }
21
- }
22
- // img태그에서는 color를 사용할 수 없으므로 filter를 사용합니다.
23
- .ce-popover-item[data-item-name="code-light-theme"] .ce-popover-item__icon {
24
- background: ${theme.color.container.marbleContainer};
25
- img {
26
- filter: ${hexToCSSFilter(theme.color.container.marbleOnContainer).filter};
27
- }
28
- }
29
- .ce-popover-item[data-item-name="code-dark-theme"] .ce-popover-item__icon {
30
- background: ${theme.color.container.obsidianContainer};
31
- img {
32
- filter: ${hexToCSSFilter(theme.color.container.obsidianOnContainer)
33
- .filter};
34
- }
35
- }
36
- `;
37
- // https://github.com/editor-js/raw/blob/master/src/index.js
38
- export class Raw extends EditorJSRaw {
39
- constructor({ data, config, api, readOnly }) {
40
- super({ data, config, api, readOnly });
41
- this._color = data.color || this.defaultColor;
42
- }
43
- set color(color) {
44
- var _a, _b;
45
- this._color = color;
46
- (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.classList.remove(...this.colors);
47
- (_b = this.textarea) === null || _b === void 0 ? void 0 : _b.classList.add(color);
48
- }
49
- get colors() {
50
- return ["code-light-theme", "code-dark-theme"];
51
- }
52
- get defaultColor() {
53
- return this.colors[0];
54
- }
55
- render() {
56
- var _a;
57
- const wrapper = super.render();
58
- (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.classList.add(this._color);
59
- return wrapper;
60
- }
61
- save(rawToolsWrapper) {
62
- return Object.assign(Object.assign({}, super.save(rawToolsWrapper)), { color: this._color });
63
- }
64
- // block tune 설정
65
- renderSettings() {
66
- const tunes = [
67
- {
68
- name: "code-light-theme",
69
- label: this.api.i18n.t("Light Theme"),
70
- icon: `<img src="${lightbulbLineSvg}" />`,
71
- },
72
- {
73
- name: "code-dark-theme",
74
- label: this.api.i18n.t("Dark Theme"),
75
- icon: `<img src="${lightbulbFillSvg}" />`,
76
- },
77
- ];
78
- return tunes.map((tune) => ({
79
- name: tune.name,
80
- icon: tune.icon,
81
- label: tune.label,
82
- isActive: this._color === tune.name,
83
- closeOnActivate: true,
84
- onActivate: () => {
85
- this.color = tune.name;
86
- },
87
- }));
88
- }
89
- static get toolbox() {
90
- return {
91
- icon: `<img src="${codeViewSvg}" />`,
92
- title: "Code",
93
- };
94
- }
95
- onPaste(event) {
96
- var _a;
97
- const content = event.detail.data;
98
- if (this.textarea) {
99
- this.textarea.textContent = (_a = content.textContent) !== null && _a !== void 0 ? _a : "";
100
- }
101
- }
102
- static get pasteConfig() {
103
- return {
104
- tags: ["PRE", "CODE", "TEXTAREA"],
105
- };
106
- }
107
- }
@@ -1,9 +0,0 @@
1
- import EditorJSTable from "@editorjs/table";
2
- export declare class Table extends EditorJSTable {
3
- static get toolbox(): {
4
- icon: string;
5
- title: string;
6
- };
7
- getConfig(configName: string, defaultValue: any, savedData: any): any;
8
- renderSettings(): any[];
9
- }
@@ -1,28 +0,0 @@
1
- import EditorJSTable from "@editorjs/table";
2
- import { table2Svg, layoutTopLineSvg, layoutGridLineSvg, } from "../../../../icons";
3
- const TUNE_ICONS = [
4
- `<img src="${layoutTopLineSvg}" />`,
5
- `<img src="${layoutGridLineSvg}" />`,
6
- ];
7
- // https://github.com/editor-js/table/blob/master/src/plugin.js
8
- export class Table extends EditorJSTable {
9
- static get toolbox() {
10
- return {
11
- icon: `<img src="${table2Svg}" />`,
12
- title: "Table",
13
- };
14
- }
15
- // https://github.com/editor-js/table/pull/134
16
- // 기존 내부의 getConfig에 오류가 있고, 이를 수정하기 위해 override합니다.
17
- getConfig(configName, defaultValue = false, savedData) {
18
- if (savedData && configName in savedData) {
19
- return savedData[configName];
20
- }
21
- return this.config && this.config[configName]
22
- ? this.config[configName]
23
- : defaultValue;
24
- }
25
- renderSettings() {
26
- return Array.from(super.renderSettings()).map((setting, i) => (Object.assign(Object.assign({}, setting), { icon: TUNE_ICONS[i] })));
27
- }
28
- }
@@ -1,16 +0,0 @@
1
- export * from "./block/Header";
2
- export * from "./block/NestedList";
3
- export * from "./block/Quote";
4
- export * from "./block/Callout";
5
- export * from "./block/Raw";
6
- export * from "./block/Delimiter";
7
- export * from "./block/Table";
8
- export * from "./block/Image";
9
- export * from "./inline/Bold";
10
- export * from "./inline/InlineCode";
11
- export * from "./inline/Italic";
12
- export * from "./inline/StrikeThrough";
13
- export * from "./inline/Underline";
14
- export * from "./tunes/MoveUp";
15
- export * from "./tunes/Delete";
16
- export * from "./tunes/MoveDown";
@@ -1,16 +0,0 @@
1
- export * from "./block/Header";
2
- export * from "./block/NestedList";
3
- export * from "./block/Quote";
4
- export * from "./block/Callout";
5
- export * from "./block/Raw";
6
- export * from "./block/Delimiter";
7
- export * from "./block/Table";
8
- export * from "./block/Image";
9
- export * from "./inline/Bold";
10
- export * from "./inline/InlineCode";
11
- export * from "./inline/Italic";
12
- export * from "./inline/StrikeThrough";
13
- export * from "./inline/Underline";
14
- export * from "./tunes/MoveUp";
15
- export * from "./tunes/Delete";
16
- export * from "./tunes/MoveDown";
@@ -1,52 +0,0 @@
1
- import { InlineTool, SanitizerConfig } from "@editorjs/editorjs";
2
- export declare class Bold implements InlineTool {
3
- /**
4
- * Specifies Tool as Inline Toolbar Tool
5
- *
6
- * @returns {boolean}
7
- */
8
- static isInline: boolean;
9
- /**
10
- * Title for hover-tooltip
11
- */
12
- static title: string;
13
- /**
14
- * Sanitizer Rule
15
- * Leave <b>, <strong> tags
16
- *
17
- * @returns {object}
18
- */
19
- static get sanitize(): SanitizerConfig;
20
- /**
21
- * Native Document's command that uses for Bold
22
- */
23
- private readonly commandName;
24
- /**
25
- * Styles
26
- */
27
- private readonly CSS;
28
- /**
29
- * Elements
30
- */
31
- private nodes;
32
- /**
33
- * Create button for Inline Toolbar
34
- */
35
- render(): HTMLElement;
36
- /**
37
- * Wrap range with <b> tag
38
- */
39
- surround(): void;
40
- /**
41
- * Check selection and set activated state to button if there are <b> tag
42
- *
43
- * @returns {boolean}
44
- */
45
- checkState(): boolean;
46
- /**
47
- * Set a shortcut
48
- *
49
- * @returns {boolean}
50
- */
51
- get shortcut(): string;
52
- }
@@ -1,83 +0,0 @@
1
- import { boldSvg } from "../../../../icons";
2
- // https://github.com/codex-team/editor.js/blob/next/src/components/inline-tools/inline-tool-bold.ts
3
- // BoldInlineTool은 editorjs에서 제공하는 기본 툴입니다.
4
- // 이 내부 툴을 export하고 있지 않아서 코드를 옮겨와 수정하여 커스텀합니다.
5
- export class Bold {
6
- constructor() {
7
- /**
8
- * Native Document's command that uses for Bold
9
- */
10
- this.commandName = "bold";
11
- /**
12
- * Styles
13
- */
14
- this.CSS = {
15
- button: "ce-inline-tool",
16
- buttonActive: "ce-inline-tool--active",
17
- buttonModifier: "ce-inline-tool--bold",
18
- };
19
- /**
20
- * Elements
21
- */
22
- this.nodes = {
23
- button: undefined,
24
- };
25
- }
26
- /**
27
- * Sanitizer Rule
28
- * Leave <b>, <strong> tags
29
- *
30
- * @returns {object}
31
- */
32
- static get sanitize() {
33
- return {
34
- b: {},
35
- strong: {},
36
- };
37
- }
38
- /**
39
- * Create button for Inline Toolbar
40
- */
41
- render() {
42
- this.nodes.button = document.createElement("button");
43
- this.nodes.button.type = "button";
44
- this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
45
- this.nodes.button.innerHTML = `<img src="${boldSvg}" />`;
46
- return this.nodes.button;
47
- }
48
- /**
49
- * Wrap range with <b> tag
50
- */
51
- surround() {
52
- document.execCommand(this.commandName);
53
- }
54
- /**
55
- * Check selection and set activated state to button if there are <b> tag
56
- *
57
- * @returns {boolean}
58
- */
59
- checkState() {
60
- var _a;
61
- const isActive = document.queryCommandState(this.commandName);
62
- (_a = this.nodes.button) === null || _a === void 0 ? void 0 : _a.classList.toggle(this.CSS.buttonActive, isActive);
63
- return isActive;
64
- }
65
- /**
66
- * Set a shortcut
67
- *
68
- * @returns {boolean}
69
- */
70
- get shortcut() {
71
- return "CMD+B";
72
- }
73
- }
74
- /**
75
- * Specifies Tool as Inline Toolbar Tool
76
- *
77
- * @returns {boolean}
78
- */
79
- Bold.isInline = true;
80
- /**
81
- * Title for hover-tooltip
82
- */
83
- Bold.title = "Bold";
@@ -1,4 +0,0 @@
1
- import EditorJSInlineCode from "@editorjs/inline-code";
2
- export declare class InlineCode extends EditorJSInlineCode {
3
- get toolboxIcon(): string;
4
- }
@@ -1,7 +0,0 @@
1
- import EditorJSInlineCode from "@editorjs/inline-code";
2
- import { codeFillSvg } from "../../../../icons";
3
- export class InlineCode extends EditorJSInlineCode {
4
- get toolboxIcon() {
5
- return `<img src="${codeFillSvg}" />`;
6
- }
7
- }
@@ -1,48 +0,0 @@
1
- import { InlineTool, SanitizerConfig } from "@editorjs/editorjs";
2
- export declare class Italic implements InlineTool {
3
- /**
4
- * Specifies Tool as Inline Toolbar Tool
5
- *
6
- * @returns {boolean}
7
- */
8
- static isInline: boolean;
9
- /**
10
- * Title for hover-tooltip
11
- */
12
- static title: string;
13
- /**
14
- * Sanitizer Rule
15
- * Leave <i>, <em> tags
16
- *
17
- * @returns {object}
18
- */
19
- static get sanitize(): SanitizerConfig;
20
- /**
21
- * Native Document's command that uses for Italic
22
- */
23
- private readonly commandName;
24
- /**
25
- * Styles
26
- */
27
- private readonly CSS;
28
- /**
29
- * Elements
30
- */
31
- private nodes;
32
- /**
33
- * Create button for Inline Toolbar
34
- */
35
- render(): HTMLElement;
36
- /**
37
- * Wrap range with <i> tag
38
- */
39
- surround(): void;
40
- /**
41
- * Check selection and set activated state to button if there are <i> tag
42
- */
43
- checkState(): boolean;
44
- /**
45
- * Set a shortcut
46
- */
47
- get shortcut(): string;
48
- }
@@ -1,79 +0,0 @@
1
- import { italicSvg } from "../../../../icons";
2
- // https://github.com/codex-team/editor.js/blob/next/src/components/inline-tools/inline-tool-italic.ts
3
- // ItalicInlineTool은 editorjs에서 제공하는 기본 툴입니다.
4
- // 이 내부 툴을 export하고 있지 않아서 코드를 옮겨와 수정하여 커스텀합니다.
5
- export class Italic {
6
- constructor() {
7
- /**
8
- * Native Document's command that uses for Italic
9
- */
10
- this.commandName = "italic";
11
- /**
12
- * Styles
13
- */
14
- this.CSS = {
15
- button: "ce-inline-tool",
16
- buttonActive: "ce-inline-tool--active",
17
- buttonModifier: "ce-inline-tool--italic",
18
- };
19
- /**
20
- * Elements
21
- */
22
- this.nodes = {
23
- button: null,
24
- };
25
- }
26
- /**
27
- * Sanitizer Rule
28
- * Leave <i>, <em> tags
29
- *
30
- * @returns {object}
31
- */
32
- static get sanitize() {
33
- return {
34
- i: {},
35
- em: {},
36
- };
37
- }
38
- /**
39
- * Create button for Inline Toolbar
40
- */
41
- render() {
42
- this.nodes.button = document.createElement("button");
43
- this.nodes.button.type = "button";
44
- this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
45
- this.nodes.button.innerHTML = `<img src="${italicSvg}" />`;
46
- return this.nodes.button;
47
- }
48
- /**
49
- * Wrap range with <i> tag
50
- */
51
- surround() {
52
- document.execCommand(this.commandName);
53
- }
54
- /**
55
- * Check selection and set activated state to button if there are <i> tag
56
- */
57
- checkState() {
58
- var _a;
59
- const isActive = document.queryCommandState(this.commandName);
60
- (_a = this.nodes.button) === null || _a === void 0 ? void 0 : _a.classList.toggle(this.CSS.buttonActive, isActive);
61
- return isActive;
62
- }
63
- /**
64
- * Set a shortcut
65
- */
66
- get shortcut() {
67
- return "CMD+I";
68
- }
69
- }
70
- /**
71
- * Specifies Tool as Inline Toolbar Tool
72
- *
73
- * @returns {boolean}
74
- */
75
- Italic.isInline = true;
76
- /**
77
- * Title for hover-tooltip
78
- */
79
- Italic.title = "Italic";
@@ -1,4 +0,0 @@
1
- import EditorStrikeThrough from "editorjs-strikethrough";
2
- export declare class StrikeThrough extends EditorStrikeThrough {
3
- get toolboxIcon(): string;
4
- }
@@ -1,7 +0,0 @@
1
- import EditorStrikeThrough from "editorjs-strikethrough";
2
- import { strikethroughSvg } from "../../../../icons";
3
- export class StrikeThrough extends EditorStrikeThrough {
4
- get toolboxIcon() {
5
- return `<img src="${strikethroughSvg}" />`;
6
- }
7
- }
@@ -1,4 +0,0 @@
1
- import EditorJSUnderline from "@editorjs/underline";
2
- export declare class Underline extends EditorJSUnderline {
3
- get toolboxIcon(): string;
4
- }