@quadrats/common 0.6.7 → 0.7.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/blockquote/createBlockquote.d.ts +1 -1
- package/blockquote/createBlockquote.js +33 -33
- package/blockquote/index.cjs.js +32 -34
- package/bold/createBold.d.ts +2 -1
- package/bold/createBold.js +6 -4
- package/bold/index.cjs.js +6 -6
- package/divider/createDivider.d.ts +1 -1
- package/divider/createDivider.js +29 -29
- package/divider/index.cjs.js +29 -31
- package/embed/createEmbed.js +40 -40
- package/embed/deserializeEmbedElementToData.js +6 -6
- package/embed/index.cjs.js +54 -56
- package/embed/serializeEmbedCode.js +8 -8
- package/embed/strategies/facebook/index.cjs.js +45 -47
- package/embed/strategies/facebook/index.d.ts +5 -5
- package/embed/strategies/facebook/index.js +45 -45
- package/embed/strategies/instagram/index.cjs.js +29 -31
- package/embed/strategies/instagram/index.d.ts +3 -3
- package/embed/strategies/instagram/index.js +29 -29
- package/embed/strategies/podcast-apple/index.cjs.js +16 -18
- package/embed/strategies/podcast-apple/index.d.ts +4 -4
- package/embed/strategies/podcast-apple/index.js +16 -16
- package/embed/strategies/spotify/index.cjs.js +14 -16
- package/embed/strategies/spotify/index.d.ts +4 -4
- package/embed/strategies/spotify/index.js +14 -14
- package/embed/strategies/twitter/index.cjs.js +41 -43
- package/embed/strategies/twitter/index.d.ts +4 -4
- package/embed/strategies/twitter/index.js +41 -41
- package/embed/strategies/vimeo/index.cjs.js +14 -16
- package/embed/strategies/vimeo/index.d.ts +3 -3
- package/embed/strategies/vimeo/index.js +14 -14
- package/embed/strategies/youtube/index.cjs.js +14 -16
- package/embed/strategies/youtube/index.d.ts +3 -3
- package/embed/strategies/youtube/index.js +14 -14
- package/embed/typings.d.ts +1 -1
- package/file-uploader/_virtual/_tslib.js +3 -1
- package/file-uploader/createFileUploader.js +76 -76
- package/file-uploader/getFilesFromInput.js +24 -24
- package/file-uploader/index.cjs.js +102 -102
- package/file-uploader/typings.d.ts +6 -6
- package/footnote/createFootnote.d.ts +1 -1
- package/footnote/createFootnote.js +65 -65
- package/footnote/index.cjs.js +65 -67
- package/footnote/typings.d.ts +1 -1
- package/heading/constants.js +1 -1
- package/heading/createHeading.d.ts +1 -1
- package/heading/createHeading.js +45 -45
- package/heading/index.cjs.js +46 -48
- package/heading/typings.d.ts +1 -1
- package/highlight/createHighlight.d.ts +2 -1
- package/highlight/createHighlight.js +6 -4
- package/highlight/index.cjs.js +6 -6
- package/image/constants.js +4 -4
- package/image/createImage.js +195 -195
- package/image/getImageElementCommonProps.js +6 -6
- package/image/getImageFigureElementCommonProps.js +5 -5
- package/image/index.cjs.js +211 -213
- package/image/isHostingNotRequired.js +2 -2
- package/image/typings.d.ts +8 -8
- package/input-block/createInputBlock.js +37 -37
- package/input-block/index.cjs.js +37 -39
- package/input-widget/typings.d.ts +1 -1
- package/italic/createItalic.d.ts +2 -1
- package/italic/createItalic.js +6 -4
- package/italic/index.cjs.js +6 -6
- package/link/createLink.js +147 -147
- package/link/index.cjs.js +146 -148
- package/link/typings.d.ts +2 -2
- package/list/constants.js +4 -4
- package/list/createList.js +185 -185
- package/list/index.cjs.js +188 -190
- package/list/typings.d.ts +4 -4
- package/package.json +4 -4
- package/read-more/createReadMore.d.ts +1 -1
- package/read-more/createReadMore.js +51 -51
- package/read-more/index.cjs.js +50 -52
- package/strikethrough/createStrikethrough.d.ts +2 -1
- package/strikethrough/createStrikethrough.js +6 -4
- package/strikethrough/index.cjs.js +6 -6
- package/toggle-mark/createToggleMarkCreator.d.ts +4 -4
- package/toggle-mark/createToggleMarkCreator.js +36 -36
- package/toggle-mark/index.cjs.js +36 -38
- package/underline/createUnderline.d.ts +2 -1
- package/underline/createUnderline.js +6 -4
- package/underline/index.cjs.js +6 -6
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createToggleMarkCreator } from '@quadrats/common/toggle-mark';
|
|
2
2
|
import { STRIKETHROUGH_TYPE } from './constants.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
function createStrikethrough(variant) {
|
|
5
|
+
return createToggleMarkCreator({
|
|
6
|
+
type: STRIKETHROUGH_TYPE,
|
|
7
|
+
variant,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
export { createStrikethrough };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var toggleMark = require('@quadrats/common/toggle-mark');
|
|
6
4
|
|
|
7
5
|
const STRIKETHROUGH_TYPE = 'strikethrough';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function createStrikethrough(variant) {
|
|
8
|
+
return toggleMark.createToggleMarkCreator({
|
|
9
|
+
type: STRIKETHROUGH_TYPE,
|
|
10
|
+
variant,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
exports.STRIKETHROUGH_TYPE = STRIKETHROUGH_TYPE;
|
|
15
15
|
exports.createStrikethrough = createStrikethrough;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WithMarkType } from '@quadrats/core';
|
|
1
|
+
import { Editor, WithMarkType } from '@quadrats/core';
|
|
2
2
|
import { ToggleMark } from './typings';
|
|
3
|
-
export
|
|
3
|
+
export type CreateToggleMarkCreatorOptions = WithMarkType & {
|
|
4
4
|
variant?: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type CreateToggleMarkOptions = Partial<CreateToggleMarkCreatorOptions> & {
|
|
7
7
|
variant?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function createToggleMarkCreator(defaults: CreateToggleMarkCreatorOptions): ({ type, variant }?: CreateToggleMarkOptions) => ToggleMark
|
|
9
|
+
export declare function createToggleMarkCreator<E extends Editor = Editor>(defaults: CreateToggleMarkCreatorOptions): ({ type, variant }?: CreateToggleMarkOptions) => ToggleMark<E>;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { getMark } from '@quadrats/core';
|
|
2
2
|
|
|
3
|
-
function createToggleMarkCreator(defaults) {
|
|
4
|
-
return ({ type = defaults.type, variant = defaults.variant } = {}) => {
|
|
5
|
-
const isToggleMarkActive = (editor) => {
|
|
6
|
-
const mark = getMark(editor, type);
|
|
7
|
-
if (mark !== true)
|
|
8
|
-
return false;
|
|
9
|
-
const nowVariant = getMark(editor, `${type}Variant`) || '';
|
|
10
|
-
if (variant) {
|
|
11
|
-
return nowVariant === variant;
|
|
12
|
-
}
|
|
13
|
-
return !nowVariant;
|
|
14
|
-
};
|
|
15
|
-
const toggleMark = (editor) => {
|
|
16
|
-
const isActive = isToggleMarkActive(editor);
|
|
17
|
-
if (isActive) {
|
|
18
|
-
editor.removeMark(type);
|
|
19
|
-
if (variant) {
|
|
20
|
-
editor.removeMark(`${type}Variant`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
editor.addMark(type, true);
|
|
25
|
-
if (variant) {
|
|
26
|
-
editor.addMark(`${type}Variant`, variant);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
editor.removeMark(`${type}Variant`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
type,
|
|
35
|
-
isToggleMarkActive,
|
|
36
|
-
toggleMark,
|
|
37
|
-
};
|
|
38
|
-
};
|
|
3
|
+
function createToggleMarkCreator(defaults) {
|
|
4
|
+
return ({ type = defaults.type, variant = defaults.variant } = {}) => {
|
|
5
|
+
const isToggleMarkActive = (editor) => {
|
|
6
|
+
const mark = getMark(editor, type);
|
|
7
|
+
if (mark !== true)
|
|
8
|
+
return false;
|
|
9
|
+
const nowVariant = getMark(editor, `${type}Variant`) || '';
|
|
10
|
+
if (variant) {
|
|
11
|
+
return nowVariant === variant;
|
|
12
|
+
}
|
|
13
|
+
return !nowVariant;
|
|
14
|
+
};
|
|
15
|
+
const toggleMark = (editor) => {
|
|
16
|
+
const isActive = isToggleMarkActive(editor);
|
|
17
|
+
if (isActive) {
|
|
18
|
+
editor.removeMark(type);
|
|
19
|
+
if (variant) {
|
|
20
|
+
editor.removeMark(`${type}Variant`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
editor.addMark(type, true);
|
|
25
|
+
if (variant) {
|
|
26
|
+
editor.addMark(`${type}Variant`, variant);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
editor.removeMark(`${type}Variant`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
type,
|
|
35
|
+
isToggleMarkActive,
|
|
36
|
+
toggleMark,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { createToggleMarkCreator };
|
package/toggle-mark/index.cjs.js
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@quadrats/core');
|
|
6
4
|
|
|
7
|
-
function createToggleMarkCreator(defaults) {
|
|
8
|
-
return ({ type = defaults.type, variant = defaults.variant } = {}) => {
|
|
9
|
-
const isToggleMarkActive = (editor) => {
|
|
10
|
-
const mark = core.getMark(editor, type);
|
|
11
|
-
if (mark !== true)
|
|
12
|
-
return false;
|
|
13
|
-
const nowVariant = core.getMark(editor, `${type}Variant`) || '';
|
|
14
|
-
if (variant) {
|
|
15
|
-
return nowVariant === variant;
|
|
16
|
-
}
|
|
17
|
-
return !nowVariant;
|
|
18
|
-
};
|
|
19
|
-
const toggleMark = (editor) => {
|
|
20
|
-
const isActive = isToggleMarkActive(editor);
|
|
21
|
-
if (isActive) {
|
|
22
|
-
editor.removeMark(type);
|
|
23
|
-
if (variant) {
|
|
24
|
-
editor.removeMark(`${type}Variant`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
editor.addMark(type, true);
|
|
29
|
-
if (variant) {
|
|
30
|
-
editor.addMark(`${type}Variant`, variant);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
editor.removeMark(`${type}Variant`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
type,
|
|
39
|
-
isToggleMarkActive,
|
|
40
|
-
toggleMark,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
5
|
+
function createToggleMarkCreator(defaults) {
|
|
6
|
+
return ({ type = defaults.type, variant = defaults.variant } = {}) => {
|
|
7
|
+
const isToggleMarkActive = (editor) => {
|
|
8
|
+
const mark = core.getMark(editor, type);
|
|
9
|
+
if (mark !== true)
|
|
10
|
+
return false;
|
|
11
|
+
const nowVariant = core.getMark(editor, `${type}Variant`) || '';
|
|
12
|
+
if (variant) {
|
|
13
|
+
return nowVariant === variant;
|
|
14
|
+
}
|
|
15
|
+
return !nowVariant;
|
|
16
|
+
};
|
|
17
|
+
const toggleMark = (editor) => {
|
|
18
|
+
const isActive = isToggleMarkActive(editor);
|
|
19
|
+
if (isActive) {
|
|
20
|
+
editor.removeMark(type);
|
|
21
|
+
if (variant) {
|
|
22
|
+
editor.removeMark(`${type}Variant`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
editor.addMark(type, true);
|
|
27
|
+
if (variant) {
|
|
28
|
+
editor.addMark(`${type}Variant`, variant);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
editor.removeMark(`${type}Variant`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
type,
|
|
37
|
+
isToggleMarkActive,
|
|
38
|
+
toggleMark,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
exports.createToggleMarkCreator = createToggleMarkCreator;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Editor } from '@quadrats/core';
|
|
2
|
+
export declare function createUnderline<E extends Editor = Editor>(variant?: string): ({ type, variant }?: import("@quadrats/common/toggle-mark").CreateToggleMarkOptions | undefined) => import("@quadrats/common/toggle-mark").ToggleMark<E>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createToggleMarkCreator } from '@quadrats/common/toggle-mark';
|
|
2
2
|
import { UNDERLINE_TYPE } from './constants.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
function createUnderline(variant) {
|
|
5
|
+
return createToggleMarkCreator({
|
|
6
|
+
type: UNDERLINE_TYPE,
|
|
7
|
+
variant,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
export { createUnderline };
|
package/underline/index.cjs.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var toggleMark = require('@quadrats/common/toggle-mark');
|
|
6
4
|
|
|
7
5
|
const UNDERLINE_TYPE = 'underline';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function createUnderline(variant) {
|
|
8
|
+
return toggleMark.createToggleMarkCreator({
|
|
9
|
+
type: UNDERLINE_TYPE,
|
|
10
|
+
variant,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
exports.UNDERLINE_TYPE = UNDERLINE_TYPE;
|
|
15
15
|
exports.createUnderline = createUnderline;
|