tiptap-essentials 1.2.1 → 2.0.0-beta.3

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/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # tiptap-essentials
2
+
3
+ Tiptap's extensions as one, `TiptapEssentials`, and the nodes they lack.
4
+
5
+ - `npm install`, then `npm run build`, writes `dist/`
6
+ - `npm test` runs the tests
7
+ - `npm run write-samples -- <dir>` writes each sample to `<dir>`, a file
8
+ each, with the version they are from
9
+ - `npm pack` writes the tarball an app tries an unpublished change from,
10
+ each try a prerelease of its own:
11
+ `npm version prerelease --preid beta --no-git-tag-version`, the flag
12
+ keeping `npm version` from committing and tagging
13
+ - A prerelease is the tarball an app passed on, published as it is once its
14
+ version is committed: `npm publish <tarball> --tag beta`. `npm version`
15
+ run again would publish the next number, or stop at the try's uncommitted
16
+ change
17
+ - A release: `npm version major|minor|patch`, then `npm publish`, which
18
+ builds and tests first
@@ -0,0 +1,28 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export interface BlockSpacingOptions {
3
+ /** The blocks that can be spaced apart from those around them. */
4
+ types: string[];
5
+ /**
6
+ * The margin space before or after a block takes, as a body writes it:
7
+ * `var(--space-40)`. No space is read or set where null.
8
+ */
9
+ space: string | null;
10
+ }
11
+ declare module '@tiptap/core' {
12
+ interface Commands<ReturnType> {
13
+ blockSpacing: {
14
+ /** Sets every block selected apart from the one before it. */
15
+ addSpaceBefore: () => ReturnType;
16
+ removeSpaceBefore: () => ReturnType;
17
+ /** Sets every block selected apart from the one after it. */
18
+ addSpaceAfter: () => ReturnType;
19
+ removeSpaceAfter: () => ReturnType;
20
+ };
21
+ }
22
+ }
23
+ /**
24
+ * Space before and after a block, as a word processor adds it: one more
25
+ * margin above or below a paragraph or a heading, the one its `space` names.
26
+ * A margin pasted in of any other size is read as none.
27
+ */
28
+ export declare const BlockSpacing: Extension<BlockSpacingOptions, any>;
@@ -0,0 +1,52 @@
1
+ import { Extension, getStyleProperty } from '@tiptap/core';
2
+ const MARGINS = {
3
+ spaceBefore: 'margin-top',
4
+ spaceAfter: 'margin-bottom'
5
+ };
6
+ /**
7
+ * Space before and after a block, as a word processor adds it: one more
8
+ * margin above or below a paragraph or a heading, the one its `space` names.
9
+ * A margin pasted in of any other size is read as none.
10
+ */
11
+ export const BlockSpacing = Extension.create({
12
+ name: 'blockSpacing',
13
+ addOptions() {
14
+ return {
15
+ types: ['paragraph', 'heading'],
16
+ space: null
17
+ };
18
+ },
19
+ addGlobalAttributes() {
20
+ const { types, space } = this.options;
21
+ const attribute = (side) => ({
22
+ default: null,
23
+ parseHTML: (element) => space !== null && getStyleProperty(element, MARGINS[side]) === space
24
+ ? space
25
+ : null,
26
+ renderHTML: (attributes) => attributes[side]
27
+ ? { style: `${MARGINS[side]}: ${attributes[side]}` }
28
+ : {}
29
+ });
30
+ return [
31
+ {
32
+ types,
33
+ attributes: {
34
+ spaceBefore: attribute('spaceBefore'),
35
+ spaceAfter: attribute('spaceAfter')
36
+ }
37
+ }
38
+ ];
39
+ },
40
+ addCommands() {
41
+ const set = (side, value) => () => ({ commands }) => this.options.space !== null &&
42
+ this.options.types
43
+ .map((type) => commands.updateAttributes(type, { [side]: value }))
44
+ .some((response) => response);
45
+ return {
46
+ addSpaceBefore: set('spaceBefore', this.options.space),
47
+ removeSpaceBefore: set('spaceBefore', null),
48
+ addSpaceAfter: set('spaceAfter', this.options.space),
49
+ removeSpaceAfter: set('spaceAfter', null)
50
+ };
51
+ }
52
+ });
@@ -0,0 +1,13 @@
1
+ import { type ColorOptions as TiptapColorOptions } from '@tiptap/extension-text-style';
2
+ export interface ColorOptions extends TiptapColorOptions {
3
+ /**
4
+ * The colours a text may take, as a body writes them:
5
+ * `var(--tiptap-text-red)`. Any colour where null.
6
+ */
7
+ colors: string[] | null;
8
+ }
9
+ /**
10
+ * Tiptap's text colour, held to a palette: a colour pasted in that is not one
11
+ * of it is read as none, and none is set.
12
+ */
13
+ export declare const Color: import("@tiptap/core").Extension<ColorOptions, any>;
package/dist/color.js ADDED
@@ -0,0 +1,37 @@
1
+ import { Color as TiptapColor } from '@tiptap/extension-text-style';
2
+ import { ifListed } from './listed.js';
3
+ /**
4
+ * Tiptap's text colour, held to a palette: a colour pasted in that is not one
5
+ * of it is read as none, and none is set.
6
+ */
7
+ export const Color = TiptapColor.extend({
8
+ addOptions() {
9
+ return {
10
+ ...this.parent(),
11
+ colors: null
12
+ };
13
+ },
14
+ addGlobalAttributes() {
15
+ const { colors } = this.options;
16
+ return (this.parent?.() ?? []).map(({ types, attributes }) => {
17
+ const { color } = attributes;
18
+ return {
19
+ types,
20
+ attributes: {
21
+ color: {
22
+ ...color,
23
+ parseHTML: (element) => ifListed(color?.parseHTML?.(element), colors)
24
+ }
25
+ }
26
+ };
27
+ });
28
+ },
29
+ addCommands() {
30
+ const commands = this.parent();
31
+ return {
32
+ ...commands,
33
+ setColor: (color) => (props) => ifListed(color, this.options.colors) !== null &&
34
+ commands.setColor(color)(props)
35
+ };
36
+ }
37
+ });
@@ -0,0 +1,14 @@
1
+ import { type FontSizeOptions as TiptapFontSizeOptions } from '@tiptap/extension-text-style';
2
+ export interface FontSizeOptions extends TiptapFontSizeOptions {
3
+ /**
4
+ * The sizes a text may take, as a body writes them: `var(--lg-font-size)`.
5
+ * Any where null.
6
+ */
7
+ fontSizes: string[] | null;
8
+ }
9
+ /**
10
+ * Tiptap's font size, held to a set of sizes, and reading 1.x's size classes
11
+ * as the sizes they stood for: a size pasted in that is not one of the set is
12
+ * read as none, and none is set.
13
+ */
14
+ export declare const FontSize: import("@tiptap/core").Extension<FontSizeOptions, any>;
@@ -0,0 +1,50 @@
1
+ import { FontSize as TiptapFontSize } from '@tiptap/extension-text-style';
2
+ import { ifListed } from './listed.js';
3
+ // 1.x wrote a size as a span of one of these classes, each standing for one
4
+ // of the site's size properties.
5
+ const CLASS_SIZES = {
6
+ 'tiptap-sm-font': 'var(--sm-font-size)',
7
+ 'tiptap-md-font': 'var(--md-font-size)',
8
+ 'tiptap-lg-font': 'var(--lg-font-size)',
9
+ 'tiptap-xl-font': 'var(--xl-font-size)'
10
+ };
11
+ function classSize(element) {
12
+ const name = Array.from(element.classList).find((name) => name in CLASS_SIZES);
13
+ return name ? CLASS_SIZES[name] : null;
14
+ }
15
+ /**
16
+ * Tiptap's font size, held to a set of sizes, and reading 1.x's size classes
17
+ * as the sizes they stood for: a size pasted in that is not one of the set is
18
+ * read as none, and none is set.
19
+ */
20
+ export const FontSize = TiptapFontSize.extend({
21
+ addOptions() {
22
+ return {
23
+ ...this.parent(),
24
+ fontSizes: null
25
+ };
26
+ },
27
+ addGlobalAttributes() {
28
+ const { fontSizes } = this.options;
29
+ return (this.parent?.() ?? []).map(({ types, attributes }) => {
30
+ const { fontSize } = attributes;
31
+ return {
32
+ types,
33
+ attributes: {
34
+ fontSize: {
35
+ ...fontSize,
36
+ parseHTML: (element) => ifListed(fontSize?.parseHTML?.(element) || classSize(element), fontSizes)
37
+ }
38
+ }
39
+ };
40
+ });
41
+ },
42
+ addCommands() {
43
+ const commands = this.parent();
44
+ return {
45
+ ...commands,
46
+ setFontSize: (fontSize) => (props) => ifListed(fontSize, this.options.fontSizes) !== null &&
47
+ commands.setFontSize(fontSize)(props)
48
+ };
49
+ }
50
+ });
@@ -0,0 +1,19 @@
1
+ import { type HighlightOptions as TiptapHighlightOptions } from '@tiptap/extension-highlight';
2
+ export interface HighlightOptions extends TiptapHighlightOptions {
3
+ /**
4
+ * The colours a highlight may take, as a body writes them:
5
+ * `var(--tiptap-highlight-yellow)`. Any colour where null.
6
+ */
7
+ colors: string[] | null;
8
+ /**
9
+ * The colour of a highlight asked for without one, as its key and
10
+ * `==text==` ask. A highlight of no colour where null, which a browser
11
+ * draws in a yellow of its own.
12
+ */
13
+ defaultColor: string | null;
14
+ }
15
+ /**
16
+ * Tiptap's highlight in many colours, held to a palette: a `mark` pasted in
17
+ * that is not of one of its colours is read as its text, and none is set.
18
+ */
19
+ export declare const Highlight: import("@tiptap/core").Mark<HighlightOptions, any>;
@@ -0,0 +1,69 @@
1
+ import { getStyleProperty, markInputRule, markPasteRule } from '@tiptap/core';
2
+ import { Highlight as TiptapHighlight, inputRegex, pasteRegex } from '@tiptap/extension-highlight';
3
+ import { ifListed } from './listed.js';
4
+ // Where Tiptap's highlight reads its colour from, the first it finds.
5
+ function colorOf(element) {
6
+ return (element.getAttribute('data-color') ||
7
+ getStyleProperty(element, 'background-color') ||
8
+ element.style.backgroundColor);
9
+ }
10
+ /**
11
+ * Tiptap's highlight in many colours, held to a palette: a `mark` pasted in
12
+ * that is not of one of its colours is read as its text, and none is set.
13
+ */
14
+ export const Highlight = TiptapHighlight.extend({
15
+ addOptions() {
16
+ return {
17
+ ...this.parent(),
18
+ multicolor: true,
19
+ colors: null,
20
+ defaultColor: null
21
+ };
22
+ },
23
+ parseHTML() {
24
+ const { colors } = this.options;
25
+ return [
26
+ {
27
+ tag: 'mark',
28
+ getAttrs: (element) => colors === null || ifListed(colorOf(element), colors) !== null
29
+ ? null
30
+ : false
31
+ }
32
+ ];
33
+ },
34
+ addCommands() {
35
+ const commands = this.parent();
36
+ const { colors, defaultColor } = this.options;
37
+ const colored = (attributes) => attributes ?? (defaultColor ? { color: defaultColor } : undefined);
38
+ const allowed = (attributes) => colors === null || ifListed(attributes?.color, colors) !== null;
39
+ return {
40
+ ...commands,
41
+ setHighlight: (attributes) => (props) => allowed(colored(attributes)) &&
42
+ commands.setHighlight(colored(attributes))(props),
43
+ toggleHighlight: (attributes) => (props) => allowed(colored(attributes)) &&
44
+ commands.toggleHighlight(colored(attributes))(props)
45
+ };
46
+ },
47
+ addInputRules() {
48
+ return [
49
+ markInputRule({
50
+ find: inputRegex,
51
+ type: this.type,
52
+ getAttributes: this.options.defaultColor
53
+ ? { color: this.options.defaultColor }
54
+ : undefined
55
+ })
56
+ ];
57
+ },
58
+ addPasteRules() {
59
+ return [
60
+ markPasteRule({
61
+ find: pasteRegex,
62
+ type: this.type,
63
+ getAttributes: this.options.defaultColor
64
+ ? { color: this.options.defaultColor }
65
+ : undefined
66
+ })
67
+ ];
68
+ }
69
+ });
@@ -0,0 +1,33 @@
1
+ /** A format a picture offers its image in, and the widths stored in it. */
2
+ export interface PictureSource {
3
+ type: string;
4
+ srcset: string;
5
+ }
6
+ /** What an image is inserted with. */
7
+ export interface ImageAttributes {
8
+ src: string;
9
+ alt?: string | null;
10
+ title?: string | null;
11
+ width?: number | null;
12
+ height?: number | null;
13
+ srcset?: string | null;
14
+ sizes?: string | null;
15
+ loading?: string | null;
16
+ style?: string | null;
17
+ sources?: PictureSource[];
18
+ }
19
+ declare module '@tiptap/core' {
20
+ interface Commands<ReturnType> {
21
+ responsiveImage: {
22
+ /** Inserts an image with the attributes a responsive one is written with. */
23
+ setImage: (options: ImageAttributes) => ReturnType;
24
+ };
25
+ }
26
+ }
27
+ /**
28
+ * Tiptap's image, taking the attributes a responsive image is written with.
29
+ * Given sources, it is written as a `<picture>`: a `<source>` for each,
30
+ * ahead of the `<img>` a browser drawing none of them is given. Read back,
31
+ * the picture is that image again.
32
+ */
33
+ export declare const Image: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
package/dist/image.js ADDED
@@ -0,0 +1,67 @@
1
+ import { mergeAttributes } from '@tiptap/core';
2
+ import TiptapImage from '@tiptap/extension-image';
3
+ /**
4
+ * Tiptap's image, taking the attributes a responsive image is written with.
5
+ * Given sources, it is written as a `<picture>`: a `<source>` for each,
6
+ * ahead of the `<img>` a browser drawing none of them is given. Read back,
7
+ * the picture is that image again.
8
+ */
9
+ export const Image = TiptapImage.extend({
10
+ addAttributes() {
11
+ return {
12
+ ...this.parent?.(),
13
+ srcset: { default: null },
14
+ sizes: { default: null },
15
+ loading: { default: null },
16
+ style: { default: null },
17
+ sources: {
18
+ default: [],
19
+ parseHTML: (element) => sourcesOf(element),
20
+ renderHTML: () => ({})
21
+ }
22
+ };
23
+ },
24
+ parseHTML() {
25
+ return [
26
+ { tag: 'picture', getAttrs: pictureAttributes },
27
+ ...(this.parent?.() ?? [])
28
+ ];
29
+ },
30
+ renderHTML({ node, HTMLAttributes }) {
31
+ const img = [
32
+ 'img',
33
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)
34
+ ];
35
+ const sources = node.attrs['sources'];
36
+ if (sources.length === 0) {
37
+ return img;
38
+ }
39
+ const { sizes } = node.attrs;
40
+ return [
41
+ 'picture',
42
+ {},
43
+ ...sources.map(({ type, srcset }) => [
44
+ 'source',
45
+ { type, srcset, sizes }
46
+ ]),
47
+ img
48
+ ];
49
+ }
50
+ });
51
+ function pictureAttributes(picture) {
52
+ const img = picture.querySelector('img');
53
+ if (!img) {
54
+ return false;
55
+ }
56
+ return Object.fromEntries(Array.from(img.attributes, ({ name, value }) => [name, value]));
57
+ }
58
+ function sourcesOf(element) {
59
+ if (element.tagName !== 'PICTURE') {
60
+ return [];
61
+ }
62
+ return Array.from(element.querySelectorAll('source')).flatMap((source) => {
63
+ const type = source.getAttribute('type');
64
+ const srcset = source.getAttribute('srcset');
65
+ return type && srcset ? [{ type, srcset }] : [];
66
+ });
67
+ }
@@ -0,0 +1,19 @@
1
+ export { TiptapEssentials } from './tiptap-essentials.js';
2
+ export type { TiptapEssentialsOptions } from './tiptap-essentials.js';
3
+ export { BlockSpacing } from './block-spacing.js';
4
+ export type { BlockSpacingOptions } from './block-spacing.js';
5
+ export { Color } from './color.js';
6
+ export type { ColorOptions } from './color.js';
7
+ export { FontSize } from './font-size.js';
8
+ export type { FontSizeOptions } from './font-size.js';
9
+ export { Highlight } from './highlight.js';
10
+ export type { HighlightOptions } from './highlight.js';
11
+ export { Image } from './image.js';
12
+ export type { ImageAttributes, PictureSource } from './image.js';
13
+ export { LineHeight } from './line-height.js';
14
+ export type { LineHeightOptions } from './line-height.js';
15
+ export { PlainSpaces } from './plain-spaces.js';
16
+ export { Table } from './table.js';
17
+ export type { TableOptions } from './table.js';
18
+ export { TextStyle } from './text-style.js';
19
+ export { Youtube } from './youtube.js';
package/dist/index.js CHANGED
@@ -1,45 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Editor", {
7
- enumerable: true,
8
- get: function get() {
9
- return _editor["default"];
10
- }
11
- });
12
- Object.defineProperty(exports, "Extension", {
13
- enumerable: true,
14
- get: function get() {
15
- return _core.Extension;
16
- }
17
- });
18
- Object.defineProperty(exports, "Mark", {
19
- enumerable: true,
20
- get: function get() {
21
- return _core.Mark;
22
- }
23
- });
24
- Object.defineProperty(exports, "Node", {
25
- enumerable: true,
26
- get: function get() {
27
- return _core.Node;
28
- }
29
- });
30
- Object.defineProperty(exports, "TiptapEssentials", {
31
- enumerable: true,
32
- get: function get() {
33
- return _tiptapEssentials.TiptapEssentials;
34
- }
35
- });
36
- Object.defineProperty(exports, "mergeAttributes", {
37
- enumerable: true,
38
- get: function get() {
39
- return _core.mergeAttributes;
40
- }
41
- });
42
- var _core = require("@tiptap/core");
43
- var _editor = _interopRequireDefault(require("./editor"));
44
- var _tiptapEssentials = require("./tiptap-essentials");
45
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1
+ export { TiptapEssentials } from './tiptap-essentials.js';
2
+ export { BlockSpacing } from './block-spacing.js';
3
+ export { Color } from './color.js';
4
+ export { FontSize } from './font-size.js';
5
+ export { Highlight } from './highlight.js';
6
+ export { Image } from './image.js';
7
+ export { LineHeight } from './line-height.js';
8
+ export { PlainSpaces } from './plain-spaces.js';
9
+ export { Table } from './table.js';
10
+ export { TextStyle } from './text-style.js';
11
+ export { Youtube } from './youtube.js';
@@ -0,0 +1,15 @@
1
+ import { type LineHeightOptions as TiptapLineHeightOptions } from '@tiptap/extension-text-style';
2
+ export interface LineHeightOptions extends TiptapLineHeightOptions {
3
+ /**
4
+ * The line heights a block may take, as a body writes them:
5
+ * `var(--tiptap-line-height-150)`. Any where null.
6
+ */
7
+ lineHeights: string[] | null;
8
+ }
9
+ /**
10
+ * Tiptap's line height, on paragraphs and headings rather than a span, and
11
+ * held to a set of steps: one pasted in that is not a step is read as none.
12
+ * Tiptap's commands style a span inside the blocks, so these style the blocks
13
+ * themselves, every one the selection touches.
14
+ */
15
+ export declare const LineHeight: import("@tiptap/core").Extension<LineHeightOptions, any>;
@@ -0,0 +1,43 @@
1
+ import { LineHeight as TiptapLineHeight } from '@tiptap/extension-text-style';
2
+ import { ifListed } from './listed.js';
3
+ /**
4
+ * Tiptap's line height, on paragraphs and headings rather than a span, and
5
+ * held to a set of steps: one pasted in that is not a step is read as none.
6
+ * Tiptap's commands style a span inside the blocks, so these style the blocks
7
+ * themselves, every one the selection touches.
8
+ */
9
+ export const LineHeight = TiptapLineHeight.extend({
10
+ addOptions() {
11
+ return {
12
+ ...this.parent(),
13
+ types: ['paragraph', 'heading'],
14
+ lineHeights: null
15
+ };
16
+ },
17
+ addGlobalAttributes() {
18
+ const { lineHeights } = this.options;
19
+ return (this.parent?.() ?? []).map(({ types, attributes }) => {
20
+ const { lineHeight } = attributes;
21
+ return {
22
+ types,
23
+ attributes: {
24
+ lineHeight: {
25
+ ...lineHeight,
26
+ parseHTML: (element) => ifListed(lineHeight?.parseHTML?.(element), lineHeights)
27
+ }
28
+ }
29
+ };
30
+ });
31
+ },
32
+ addCommands() {
33
+ return {
34
+ setLineHeight: (lineHeight) => ({ commands }) => ifListed(lineHeight, this.options.lineHeights) !== null &&
35
+ this.options.types
36
+ .map((type) => commands.updateAttributes(type, { lineHeight }))
37
+ .some((response) => response),
38
+ unsetLineHeight: () => ({ commands }) => this.options.types
39
+ .map((type) => commands.resetAttributes(type, 'lineHeight'))
40
+ .some((response) => response)
41
+ };
42
+ }
43
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A value read from a body, kept only where the list of the values it may take
3
+ * names it as it is written. Without a list, any value is kept.
4
+ */
5
+ export declare function ifListed(value: unknown, list: readonly string[] | null): string | null;
package/dist/listed.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A value read from a body, kept only where the list of the values it may take
3
+ * names it as it is written. Without a list, any value is kept.
4
+ */
5
+ export function ifListed(value, list) {
6
+ if (typeof value !== 'string') {
7
+ return null;
8
+ }
9
+ return list === null || list.includes(value) ? value : null;
10
+ }
@@ -0,0 +1,7 @@
1
+ import { Extension } from '@tiptap/core';
2
+ /**
3
+ * Pasted text with its no-break spaces read as plain ones. A page copied from
4
+ * holds them wherever its layout wanted words kept together, which in a body
5
+ * would stop its lines breaking where the reader's window needs them to.
6
+ */
7
+ export declare const PlainSpaces: Extension<any, any>;
@@ -0,0 +1,35 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { Fragment, Slice } from '@tiptap/pm/model';
3
+ import { Plugin, PluginKey } from '@tiptap/pm/state';
4
+ const NO_BREAK_SPACE = '\u{a0}';
5
+ /**
6
+ * Pasted text with its no-break spaces read as plain ones. A page copied from
7
+ * holds them wherever its layout wanted words kept together, which in a body
8
+ * would stop its lines breaking where the reader's window needs them to.
9
+ */
10
+ export const PlainSpaces = Extension.create({
11
+ name: 'plainSpaces',
12
+ addProseMirrorPlugins() {
13
+ return [
14
+ new Plugin({
15
+ key: new PluginKey('plainSpaces'),
16
+ props: {
17
+ transformPasted: (slice) => new Slice(plain(slice.content), slice.openStart, slice.openEnd)
18
+ }
19
+ })
20
+ ];
21
+ }
22
+ });
23
+ function plain(fragment) {
24
+ const nodes = [];
25
+ fragment.forEach((node) => {
26
+ if (node.isText) {
27
+ const text = node.text?.replaceAll(NO_BREAK_SPACE, ' ') ?? '';
28
+ nodes.push(node.type.schema.text(text, node.marks));
29
+ }
30
+ else {
31
+ nodes.push(node.copy(plain(node.content)));
32
+ }
33
+ });
34
+ return Fragment.fromArray(nodes);
35
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The markup the library writes for each feature, as it writes it. Its tests
3
+ * read each back and write it out unchanged; a project storing bodies checks
4
+ * against them that it keeps what the editor writes.
5
+ */
6
+ export declare const picture: string;
7
+ export declare const table: string;
8
+ export declare const video: string;
9
+ export declare const size = "<p><span style=\"font-size: var(--lg-font-size);\">Large</span> text</p>";
10
+ export declare const color = "<p><span style=\"color: var(--tiptap-text-red);\">Red</span> text</p>";
11
+ export declare const highlight: string;
12
+ export declare const spacing: string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The markup the library writes for each feature, as it writes it. Its tests
3
+ * read each back and write it out unchanged; a project storing bodies checks
4
+ * against them that it keeps what the editor writes.
5
+ */
6
+ export const picture = '<picture><source type="image/jxl" srcset="https://static.example/uploads/store/photo-300.jxl 300w" sizes="auto">' +
7
+ '<img src="https://static.example/uploads/store/photo-1200.jpg" alt="A harbour" title="A harbour" ' +
8
+ 'srcset="https://static.example/uploads/store/photo-300.jpg 300w" sizes="auto" loading="lazy" ' +
9
+ 'style="width: 100%; aspect-ratio: 3 / 2;"></picture>';
10
+ export const table = '<div class="table-responsive" role="region" tabindex="0" aria-label="Table">' +
11
+ '<table class="tiptap-table"><tbody>' +
12
+ '<tr><th><p>Port</p></th><th><p>Ships</p></th></tr>' +
13
+ '<tr><td><p>Chattogram</p></td><td><p>12</p></td></tr>' +
14
+ '</tbody></table></div>';
15
+ export const video = '<div data-youtube-video=""><iframe width="640" height="480" allowfullscreen="true" ' +
16
+ 'src="https://www.youtube.com/embed/M7lc1UVf-VE?start=90&amp;rel=1" title="A talk"></iframe></div>';
17
+ export const size = '<p><span style="font-size: var(--lg-font-size);">Large</span> text</p>';
18
+ export const color = '<p><span style="color: var(--tiptap-text-red);">Red</span> text</p>';
19
+ export const highlight = '<p><mark data-color="var(--tiptap-highlight-yellow)" ' +
20
+ 'style="background-color: var(--tiptap-highlight-yellow); color: inherit;">Marked</mark> text</p>';
21
+ export const spacing = '<p style="line-height: var(--tiptap-line-height-150); margin-top: var(--space-40); ' +
22
+ 'margin-bottom: var(--space-40);">Spaced</p>';