@team-monolith/cds 0.28.0 → 0.29.0
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/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -12
- package/dist/components/SquareButton.js +13 -12
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/patterns/ReactEditorJS/FormEditorJS.d.ts +8 -0
- package/dist/patterns/ReactEditorJS/FormEditorJS.js +133 -0
- package/dist/patterns/ReactEditorJS/Layout.d.ts +6 -0
- package/dist/patterns/ReactEditorJS/Layout.js +14 -0
- package/dist/patterns/ReactEditorJS/ReactEditorJS.d.ts +11 -0
- package/dist/patterns/ReactEditorJS/ReactEditorJS.js +137 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Callout.d.ts +40 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Callout.js +135 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Delimiter.d.ts +10 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Delimiter.js +50 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Header.d.ts +60 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Header.js +179 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Image.d.ts +21 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Image.js +84 -0
- package/dist/patterns/ReactEditorJS/customTools/block/NestedList.d.ts +28 -0
- package/dist/patterns/ReactEditorJS/customTools/block/NestedList.js +134 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Quote.d.ts +40 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Quote.js +135 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Raw.d.ts +26 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Raw.js +119 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Table.d.ts +10 -0
- package/dist/patterns/ReactEditorJS/customTools/block/Table.js +67 -0
- package/dist/patterns/ReactEditorJS/customTools/index.d.ts +16 -0
- package/dist/patterns/ReactEditorJS/customTools/index.js +16 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Bold.d.ts +52 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Bold.js +92 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/InlineCode.d.ts +4 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/InlineCode.js +32 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Italic.d.ts +48 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Italic.js +88 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/StrikeThrough.d.ts +4 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/StrikeThrough.js +32 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Underline.d.ts +4 -0
- package/dist/patterns/ReactEditorJS/customTools/inline/Underline.js +32 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/Delete.d.ts +30 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/Delete.js +40 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/MoveDown.d.ts +34 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/MoveDown.js +62 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/MoveUp.d.ts +34 -0
- package/dist/patterns/ReactEditorJS/customTools/tunes/MoveUp.js +72 -0
- package/dist/patterns/ReactEditorJS/i18n.d.ts +127 -0
- package/dist/patterns/ReactEditorJS/i18n.js +127 -0
- package/dist/patterns/ReactEditorJS/index.d.ts +2 -0
- package/dist/patterns/ReactEditorJS/index.js +2 -0
- package/dist/patterns/ReactEditorJS/tools.d.ts +78 -0
- package/dist/patterns/ReactEditorJS/tools.js +104 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +1 -1
- package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +1 -1
- package/package.json +15 -1
- package/dist/components/Popover.d.ts +0 -16
- package/dist/components/Popover.js +0 -40
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
var Bold = /** @class */ (function () {
|
|
6
|
+
function Bold() {
|
|
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
|
+
Object.defineProperty(Bold, "sanitize", {
|
|
27
|
+
/**
|
|
28
|
+
* Sanitizer Rule
|
|
29
|
+
* Leave <b> tags
|
|
30
|
+
*
|
|
31
|
+
* @returns {object}
|
|
32
|
+
*/
|
|
33
|
+
get: function () {
|
|
34
|
+
return {
|
|
35
|
+
b: {},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Create button for Inline Toolbar
|
|
43
|
+
*/
|
|
44
|
+
Bold.prototype.render = function () {
|
|
45
|
+
this.nodes.button = document.createElement("button");
|
|
46
|
+
this.nodes.button.type = "button";
|
|
47
|
+
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
|
48
|
+
this.nodes.button.innerHTML = "<img src=\"".concat(boldSvg, "\" />");
|
|
49
|
+
return this.nodes.button;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Wrap range with <b> tag
|
|
53
|
+
*/
|
|
54
|
+
Bold.prototype.surround = function () {
|
|
55
|
+
document.execCommand(this.commandName);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Check selection and set activated state to button if there are <b> tag
|
|
59
|
+
*
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
62
|
+
Bold.prototype.checkState = function () {
|
|
63
|
+
var _a;
|
|
64
|
+
var isActive = document.queryCommandState(this.commandName);
|
|
65
|
+
(_a = this.nodes.button) === null || _a === void 0 ? void 0 : _a.classList.toggle(this.CSS.buttonActive, isActive);
|
|
66
|
+
return isActive;
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(Bold.prototype, "shortcut", {
|
|
69
|
+
/**
|
|
70
|
+
* Set a shortcut
|
|
71
|
+
*
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
get: function () {
|
|
75
|
+
return "CMD+B";
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Specifies Tool as Inline Toolbar Tool
|
|
82
|
+
*
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
*/
|
|
85
|
+
Bold.isInline = true;
|
|
86
|
+
/**
|
|
87
|
+
* Title for hover-tooltip
|
|
88
|
+
*/
|
|
89
|
+
Bold.title = "Bold";
|
|
90
|
+
return Bold;
|
|
91
|
+
}());
|
|
92
|
+
export { Bold };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import EditorJSInlineCode from "@editorjs/inline-code";
|
|
17
|
+
import { codeFillSvg } from "../../../../icons";
|
|
18
|
+
var InlineCode = /** @class */ (function (_super) {
|
|
19
|
+
__extends(InlineCode, _super);
|
|
20
|
+
function InlineCode() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(InlineCode.prototype, "toolboxIcon", {
|
|
24
|
+
get: function () {
|
|
25
|
+
return "<img src=\"".concat(codeFillSvg, "\" />");
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
return InlineCode;
|
|
31
|
+
}(EditorJSInlineCode));
|
|
32
|
+
export { InlineCode };
|
|
@@ -0,0 +1,48 @@
|
|
|
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> 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
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
var Italic = /** @class */ (function () {
|
|
6
|
+
function Italic() {
|
|
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
|
+
Object.defineProperty(Italic, "sanitize", {
|
|
27
|
+
/**
|
|
28
|
+
* Sanitizer Rule
|
|
29
|
+
* Leave <i> tags
|
|
30
|
+
*
|
|
31
|
+
* @returns {object}
|
|
32
|
+
*/
|
|
33
|
+
get: function () {
|
|
34
|
+
return {
|
|
35
|
+
i: {},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Create button for Inline Toolbar
|
|
43
|
+
*/
|
|
44
|
+
Italic.prototype.render = function () {
|
|
45
|
+
this.nodes.button = document.createElement("button");
|
|
46
|
+
this.nodes.button.type = "button";
|
|
47
|
+
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
|
48
|
+
this.nodes.button.innerHTML = "<img src=\"".concat(italicSvg, "\" />");
|
|
49
|
+
return this.nodes.button;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Wrap range with <i> tag
|
|
53
|
+
*/
|
|
54
|
+
Italic.prototype.surround = function () {
|
|
55
|
+
document.execCommand(this.commandName);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Check selection and set activated state to button if there are <i> tag
|
|
59
|
+
*/
|
|
60
|
+
Italic.prototype.checkState = function () {
|
|
61
|
+
var _a;
|
|
62
|
+
var isActive = document.queryCommandState(this.commandName);
|
|
63
|
+
(_a = this.nodes.button) === null || _a === void 0 ? void 0 : _a.classList.toggle(this.CSS.buttonActive, isActive);
|
|
64
|
+
return isActive;
|
|
65
|
+
};
|
|
66
|
+
Object.defineProperty(Italic.prototype, "shortcut", {
|
|
67
|
+
/**
|
|
68
|
+
* Set a shortcut
|
|
69
|
+
*/
|
|
70
|
+
get: function () {
|
|
71
|
+
return "CMD+I";
|
|
72
|
+
},
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Specifies Tool as Inline Toolbar Tool
|
|
78
|
+
*
|
|
79
|
+
* @returns {boolean}
|
|
80
|
+
*/
|
|
81
|
+
Italic.isInline = true;
|
|
82
|
+
/**
|
|
83
|
+
* Title for hover-tooltip
|
|
84
|
+
*/
|
|
85
|
+
Italic.title = "Italic";
|
|
86
|
+
return Italic;
|
|
87
|
+
}());
|
|
88
|
+
export { Italic };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import EditorStrikeThrough from "editorjs-strikethrough";
|
|
17
|
+
import { strikethroughSvg } from "../../../../icons";
|
|
18
|
+
var StrikeThrough = /** @class */ (function (_super) {
|
|
19
|
+
__extends(StrikeThrough, _super);
|
|
20
|
+
function StrikeThrough() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(StrikeThrough.prototype, "toolboxIcon", {
|
|
24
|
+
get: function () {
|
|
25
|
+
return "<img src=\"".concat(strikethroughSvg, "\" />");
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
return StrikeThrough;
|
|
31
|
+
}(EditorStrikeThrough));
|
|
32
|
+
export { StrikeThrough };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import EditorJSUnderline from "@editorjs/underline";
|
|
17
|
+
import { underlineSvg } from "../../../../icons";
|
|
18
|
+
var Underline = /** @class */ (function (_super) {
|
|
19
|
+
__extends(Underline, _super);
|
|
20
|
+
function Underline() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(Underline.prototype, "toolboxIcon", {
|
|
24
|
+
get: function () {
|
|
25
|
+
return "<img src=\"".concat(underlineSvg, "\" />");
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
return Underline;
|
|
31
|
+
}(EditorJSUnderline));
|
|
32
|
+
export { Underline };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BlockTune, API } from "@editorjs/editorjs";
|
|
2
|
+
import { TunesMenuConfig } from "@editorjs/editorjs/types/tools";
|
|
3
|
+
export declare class Delete implements BlockTune {
|
|
4
|
+
/**
|
|
5
|
+
* Set Tool is Tune
|
|
6
|
+
*/
|
|
7
|
+
static readonly isTune = true;
|
|
8
|
+
/**
|
|
9
|
+
* Property that contains Editor.js API methods
|
|
10
|
+
*
|
|
11
|
+
* @see {@link docs/api.md}
|
|
12
|
+
*/
|
|
13
|
+
private readonly api;
|
|
14
|
+
/**
|
|
15
|
+
* DeleteTune constructor
|
|
16
|
+
*
|
|
17
|
+
* @param {API} api - Editor's API
|
|
18
|
+
*/
|
|
19
|
+
constructor({ api }: {
|
|
20
|
+
api: API;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Tune's appearance in block settings menu
|
|
24
|
+
*/
|
|
25
|
+
render(): TunesMenuConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Delete block conditions passed
|
|
28
|
+
*/
|
|
29
|
+
handleClick(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { closeFillSvg } from "../../../../icons";
|
|
2
|
+
// https://github.com/codex-team/editor.js/blob/next/src/components/block-tunes/block-tune-delete.ts
|
|
3
|
+
var Delete = /** @class */ (function () {
|
|
4
|
+
/**
|
|
5
|
+
* DeleteTune constructor
|
|
6
|
+
*
|
|
7
|
+
* @param {API} api - Editor's API
|
|
8
|
+
*/
|
|
9
|
+
function Delete(_a) {
|
|
10
|
+
var api = _a.api;
|
|
11
|
+
this.api = api;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Tune's appearance in block settings menu
|
|
15
|
+
*/
|
|
16
|
+
Delete.prototype.render = function () {
|
|
17
|
+
var _this = this;
|
|
18
|
+
return {
|
|
19
|
+
icon: "<img src=\"".concat(closeFillSvg, "\" />"),
|
|
20
|
+
title: this.api.i18n.t("Delete"),
|
|
21
|
+
name: "delete",
|
|
22
|
+
confirmation: {
|
|
23
|
+
title: this.api.i18n.t("Click to delete"),
|
|
24
|
+
onActivate: function () { return _this.handleClick(); },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Delete block conditions passed
|
|
30
|
+
*/
|
|
31
|
+
Delete.prototype.handleClick = function () {
|
|
32
|
+
this.api.blocks.delete();
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Set Tool is Tune
|
|
36
|
+
*/
|
|
37
|
+
Delete.isTune = true;
|
|
38
|
+
return Delete;
|
|
39
|
+
}());
|
|
40
|
+
export { Delete };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BlockTune, API } from "@editorjs/editorjs";
|
|
2
|
+
import { TunesMenuConfig } from "@editorjs/editorjs/types/tools";
|
|
3
|
+
export declare class MoveDown implements BlockTune {
|
|
4
|
+
/**
|
|
5
|
+
* Set Tool is Tune
|
|
6
|
+
*/
|
|
7
|
+
static readonly isTune = true;
|
|
8
|
+
/**
|
|
9
|
+
* Property that contains Editor.js API methods
|
|
10
|
+
*
|
|
11
|
+
* @see {@link docs/api.md}
|
|
12
|
+
*/
|
|
13
|
+
private readonly api;
|
|
14
|
+
/**
|
|
15
|
+
* Styles
|
|
16
|
+
*/
|
|
17
|
+
private CSS;
|
|
18
|
+
/**
|
|
19
|
+
* MoveDownTune constructor
|
|
20
|
+
*
|
|
21
|
+
* @param {API} api — Editor's API
|
|
22
|
+
*/
|
|
23
|
+
constructor({ api }: {
|
|
24
|
+
api: API;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Tune's appearance in block settings menu
|
|
28
|
+
*/
|
|
29
|
+
render(): TunesMenuConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Handle clicks on 'move down' button
|
|
32
|
+
*/
|
|
33
|
+
handleClick(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { arrowDownLineSvg } from "../../../../icons";
|
|
2
|
+
// https://github.com/codex-team/editor.js/blob/next/src/components/block-tunes/block-tune-move-down.ts
|
|
3
|
+
var MoveDown = /** @class */ (function () {
|
|
4
|
+
/**
|
|
5
|
+
* MoveDownTune constructor
|
|
6
|
+
*
|
|
7
|
+
* @param {API} api — Editor's API
|
|
8
|
+
*/
|
|
9
|
+
function MoveDown(_a) {
|
|
10
|
+
var api = _a.api;
|
|
11
|
+
/**
|
|
12
|
+
* Styles
|
|
13
|
+
*/
|
|
14
|
+
this.CSS = {
|
|
15
|
+
animation: "wobble",
|
|
16
|
+
};
|
|
17
|
+
this.api = api;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tune's appearance in block settings menu
|
|
21
|
+
*/
|
|
22
|
+
MoveDown.prototype.render = function () {
|
|
23
|
+
var _this = this;
|
|
24
|
+
return {
|
|
25
|
+
icon: "<img src=\"".concat(arrowDownLineSvg, "\" />"),
|
|
26
|
+
title: this.api.i18n.t("Move down"),
|
|
27
|
+
onActivate: function () { return _this.handleClick(); },
|
|
28
|
+
name: "move-down",
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Handle clicks on 'move down' button
|
|
33
|
+
*/
|
|
34
|
+
MoveDown.prototype.handleClick = function () {
|
|
35
|
+
var currentBlockIndex = this.api.blocks.getCurrentBlockIndex();
|
|
36
|
+
var nextBlock = this.api.blocks.getBlockByIndex(currentBlockIndex + 1);
|
|
37
|
+
// If Block is last do nothing
|
|
38
|
+
if (!nextBlock) {
|
|
39
|
+
throw new Error("Unable to move Block down since it is already the last");
|
|
40
|
+
}
|
|
41
|
+
var nextBlockElement = nextBlock.holder;
|
|
42
|
+
var nextBlockCoords = nextBlockElement.getBoundingClientRect();
|
|
43
|
+
var scrollOffset = Math.abs(window.innerHeight - nextBlockElement.offsetHeight);
|
|
44
|
+
/**
|
|
45
|
+
* Next block ends on screen.
|
|
46
|
+
* Increment scroll by next block's height to save element onscreen-position
|
|
47
|
+
*/
|
|
48
|
+
if (nextBlockCoords.top < window.innerHeight) {
|
|
49
|
+
scrollOffset = window.scrollY + nextBlockElement.offsetHeight;
|
|
50
|
+
}
|
|
51
|
+
window.scrollTo(0, scrollOffset);
|
|
52
|
+
/** Change blocks positions */
|
|
53
|
+
this.api.blocks.move(currentBlockIndex + 1);
|
|
54
|
+
this.api.toolbar.toggleBlockSettings(true);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Set Tool is Tune
|
|
58
|
+
*/
|
|
59
|
+
MoveDown.isTune = true;
|
|
60
|
+
return MoveDown;
|
|
61
|
+
}());
|
|
62
|
+
export { MoveDown };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BlockTune, API } from "@editorjs/editorjs";
|
|
2
|
+
import { TunesMenuConfig } from "@editorjs/editorjs/types/tools";
|
|
3
|
+
export declare class MoveUp implements BlockTune {
|
|
4
|
+
/**
|
|
5
|
+
* Set Tool is Tune
|
|
6
|
+
*/
|
|
7
|
+
static readonly isTune = true;
|
|
8
|
+
/**
|
|
9
|
+
* Property that contains Editor.js API methods
|
|
10
|
+
*
|
|
11
|
+
* @see {@link docs/api.md}
|
|
12
|
+
*/
|
|
13
|
+
private readonly api;
|
|
14
|
+
/**
|
|
15
|
+
* Styles
|
|
16
|
+
*/
|
|
17
|
+
private CSS;
|
|
18
|
+
/**
|
|
19
|
+
* MoveUpTune constructor
|
|
20
|
+
*
|
|
21
|
+
* @param {API} api - Editor's API
|
|
22
|
+
*/
|
|
23
|
+
constructor({ api }: {
|
|
24
|
+
api: API;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Tune's appearance in block settings menu
|
|
28
|
+
*/
|
|
29
|
+
render(): TunesMenuConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Move current block up
|
|
32
|
+
*/
|
|
33
|
+
handleClick(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { arrowUpLineSvg } from "../../../../icons";
|
|
2
|
+
// https://github.com/codex-team/editor.js/blob/next/src/components/block-tunes/block-tune-move-up.ts
|
|
3
|
+
var MoveUp = /** @class */ (function () {
|
|
4
|
+
/**
|
|
5
|
+
* MoveUpTune constructor
|
|
6
|
+
*
|
|
7
|
+
* @param {API} api - Editor's API
|
|
8
|
+
*/
|
|
9
|
+
function MoveUp(_a) {
|
|
10
|
+
var api = _a.api;
|
|
11
|
+
/**
|
|
12
|
+
* Styles
|
|
13
|
+
*/
|
|
14
|
+
this.CSS = {
|
|
15
|
+
animation: "wobble",
|
|
16
|
+
};
|
|
17
|
+
this.api = api;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tune's appearance in block settings menu
|
|
21
|
+
*/
|
|
22
|
+
MoveUp.prototype.render = function () {
|
|
23
|
+
var _this = this;
|
|
24
|
+
return {
|
|
25
|
+
icon: "<img src=\"".concat(arrowUpLineSvg, "\" />"),
|
|
26
|
+
title: this.api.i18n.t("Move up"),
|
|
27
|
+
onActivate: function () { return _this.handleClick(); },
|
|
28
|
+
name: "move-up",
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Move current block up
|
|
33
|
+
*/
|
|
34
|
+
MoveUp.prototype.handleClick = function () {
|
|
35
|
+
var currentBlockIndex = this.api.blocks.getCurrentBlockIndex();
|
|
36
|
+
var currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex);
|
|
37
|
+
var previousBlock = this.api.blocks.getBlockByIndex(currentBlockIndex - 1);
|
|
38
|
+
if (currentBlockIndex === 0 || !currentBlock || !previousBlock) {
|
|
39
|
+
throw new Error("Unable to move Block up since it is already the first");
|
|
40
|
+
}
|
|
41
|
+
var currentBlockElement = currentBlock.holder;
|
|
42
|
+
var previousBlockElement = previousBlock.holder;
|
|
43
|
+
/**
|
|
44
|
+
* Here is two cases:
|
|
45
|
+
* - when previous block has negative offset and part of it is visible on window, then we scroll
|
|
46
|
+
* by window's height and add offset which is mathematically difference between two blocks
|
|
47
|
+
*
|
|
48
|
+
* - when previous block is visible and has offset from the window,
|
|
49
|
+
* than we scroll window to the difference between this offsets.
|
|
50
|
+
*/
|
|
51
|
+
var currentBlockCoords = currentBlockElement.getBoundingClientRect(), previousBlockCoords = previousBlockElement.getBoundingClientRect();
|
|
52
|
+
var scrollUpOffset;
|
|
53
|
+
if (previousBlockCoords.top > 0) {
|
|
54
|
+
scrollUpOffset =
|
|
55
|
+
Math.abs(currentBlockCoords.top) - Math.abs(previousBlockCoords.top);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
scrollUpOffset =
|
|
59
|
+
Math.abs(currentBlockCoords.top) + previousBlockCoords.height;
|
|
60
|
+
}
|
|
61
|
+
window.scrollBy(0, -1 * scrollUpOffset);
|
|
62
|
+
/** Change blocks positions */
|
|
63
|
+
this.api.blocks.move(currentBlockIndex - 1);
|
|
64
|
+
this.api.toolbar.toggleBlockSettings(true);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Set Tool is Tune
|
|
68
|
+
*/
|
|
69
|
+
MoveUp.isTune = true;
|
|
70
|
+
return MoveUp;
|
|
71
|
+
}());
|
|
72
|
+
export { MoveUp };
|