@atlaskit/editor-wikimarkup-transformer 11.2.0 → 11.2.2
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/CHANGELOG.md +12 -0
- package/char/package.json +2 -2
- package/dist/cjs/parser/tokenize/link-text.js +3 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/parser/tokenize/link-text.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/parser/tokenize/link-text.js +3 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/encoder/index.d.ts +3 -3
- package/dist/types/encoder/nodes/listItem.d.ts +1 -1
- package/dist/types/interfaces.d.ts +3 -3
- package/dist/types/parser/tokenize/index.d.ts +3 -3
- package/dist/types/parser/tokenize/issue-key.d.ts +1 -1
- package/dist/types-ts4.5/char.d.ts +1 -0
- package/dist/types-ts4.5/encoder/emoji-unicode-mapping.d.ts +3 -0
- package/dist/types-ts4.5/encoder/index.d.ts +9 -0
- package/dist/types-ts4.5/encoder/marks/__base.d.ts +5 -0
- package/dist/types-ts4.5/encoder/marks/code.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/color.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/em.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/link.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/strike.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/strong.d.ts +6 -0
- package/dist/types-ts4.5/encoder/marks/subsup.d.ts +2 -0
- package/dist/types-ts4.5/encoder/marks/underline.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/block-card.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/blockquote.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/bullet-list.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/caption.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/code-block.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/date.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/decisionItem.d.ts +3 -0
- package/dist/types-ts4.5/encoder/nodes/decisionList.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/doc.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/embed-card.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/emoji.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/expand.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/hard-break.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/heading.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/inline-card.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/inlines.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/listItem.d.ts +3 -0
- package/dist/types-ts4.5/encoder/nodes/media-group.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/media-inline.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/media.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/mention.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/ordered-list.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/panel.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/paragraph.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/rule.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/status.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/table.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/taskItem.d.ts +3 -0
- package/dist/types-ts4.5/encoder/nodes/taskList.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/text.d.ts +2 -0
- package/dist/types-ts4.5/encoder/nodes/unknown.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +15 -0
- package/dist/types-ts4.5/interfaces.d.ts +74 -0
- package/dist/types-ts4.5/parser/abstract-tree.d.ts +11 -0
- package/dist/types-ts4.5/parser/builder/list-builder.d.ts +66 -0
- package/dist/types-ts4.5/parser/builder/table-builder.d.ts +45 -0
- package/dist/types-ts4.5/parser/color.d.ts +3 -0
- package/dist/types-ts4.5/parser/error.d.ts +1 -0
- package/dist/types-ts4.5/parser/nodes/mediaGroup.d.ts +3 -0
- package/dist/types-ts4.5/parser/nodes/mediaSingle.d.ts +5 -0
- package/dist/types-ts4.5/parser/nodes/paragraph.d.ts +7 -0
- package/dist/types-ts4.5/parser/nodes/rule.d.ts +3 -0
- package/dist/types-ts4.5/parser/nodes/text.d.ts +2 -0
- package/dist/types-ts4.5/parser/text.d.ts +10 -0
- package/dist/types-ts4.5/parser/tokenize/adf-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/anchor-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/blockquote.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/citation.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/code-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/color-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/common-formatter.d.ts +10 -0
- package/dist/types-ts4.5/parser/tokenize/common-macro.d.ts +10 -0
- package/dist/types-ts4.5/parser/tokenize/dash-token-creator.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/deleted.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/double-dash-symbol.d.ts +1 -0
- package/dist/types-ts4.5/parser/tokenize/emoji.d.ts +15 -0
- package/dist/types-ts4.5/parser/tokenize/emphasis.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/file-link.d.ts +3 -0
- package/dist/types-ts4.5/parser/tokenize/force-line-break.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/hardbreak.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/heading.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/index.d.ts +55 -0
- package/dist/types-ts4.5/parser/tokenize/inserted.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/issue-key.d.ts +20 -0
- package/dist/types-ts4.5/parser/tokenize/keyword.d.ts +19 -0
- package/dist/types-ts4.5/parser/tokenize/link-text.d.ts +3 -0
- package/dist/types-ts4.5/parser/tokenize/links/attachment-link.d.ts +4 -0
- package/dist/types-ts4.5/parser/tokenize/links/issue-link.d.ts +4 -0
- package/dist/types-ts4.5/parser/tokenize/links/link-format.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/links/link-parser.d.ts +17 -0
- package/dist/types-ts4.5/parser/tokenize/links/link-resolver.d.ts +5 -0
- package/dist/types-ts4.5/parser/tokenize/links/mention-link.d.ts +4 -0
- package/dist/types-ts4.5/parser/tokenize/links/url-link.d.ts +4 -0
- package/dist/types-ts4.5/parser/tokenize/list.d.ts +3 -0
- package/dist/types-ts4.5/parser/tokenize/media.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/monospace.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/noformat-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/panel-macro.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/quadruple-dash-symbol.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/quote-macro.d.ts +5 -0
- package/dist/types-ts4.5/parser/tokenize/ruler.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/strong.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/subscript.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/superscript.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/table.d.ts +2 -0
- package/dist/types-ts4.5/parser/tokenize/triple-dash-symbol.d.ts +1 -0
- package/dist/types-ts4.5/parser/tokenize/whitespace.d.ts +3 -0
- package/dist/types-ts4.5/parser/utils/attrs.d.ts +3 -0
- package/dist/types-ts4.5/parser/utils/color-name-mapping.d.ts +10 -0
- package/dist/types-ts4.5/parser/utils/escape.d.ts +2 -0
- package/dist/types-ts4.5/parser/utils/normalize.d.ts +4 -0
- package/dist/types-ts4.5/parser/utils/panel-type.d.ts +3 -0
- package/dist/types-ts4.5/parser/utils/text.d.ts +25 -0
- package/dist/types-ts4.5/parser/utils/title.d.ts +7 -0
- package/dist/types-ts4.5/parser/utils/url.d.ts +8 -0
- package/interfaces/package.json +2 -2
- package/package.json +15 -7
- package/tmp/api-report-tmp.d.ts +76 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-wikimarkup-transformer
|
|
2
2
|
|
|
3
|
+
## 11.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a142ba1aa28`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a142ba1aa28) - [ED17172] Bump prosemirror-model to 1.16.0 and prosemirror-view to 1.23.7 and removed work-arounds for fixed issues
|
|
8
|
+
|
|
9
|
+
## 11.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
14
|
+
|
|
3
15
|
## 11.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/char/package.json
CHANGED
|
@@ -13,11 +13,11 @@ var linkText = function linkText(_ref) {
|
|
|
13
13
|
var input = _ref.input,
|
|
14
14
|
position = _ref.position,
|
|
15
15
|
schema = _ref.schema;
|
|
16
|
-
var
|
|
17
|
-
if (!
|
|
16
|
+
var matches = input.substring(position).match(LINK_TEXT_REGEXP);
|
|
17
|
+
if (!matches) {
|
|
18
18
|
return fallback(input, position);
|
|
19
19
|
}
|
|
20
|
-
match = trimBadEndChar(
|
|
20
|
+
var match = trimBadEndChar(matches);
|
|
21
21
|
|
|
22
22
|
// Remove mailto:
|
|
23
23
|
var textRepresentation = match[1] === 'mailto:' ? match[2] : match[0];
|
package/dist/cjs/version.json
CHANGED
|
@@ -7,11 +7,11 @@ export const linkText = ({
|
|
|
7
7
|
position,
|
|
8
8
|
schema
|
|
9
9
|
}) => {
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
10
|
+
let matches = input.substring(position).match(LINK_TEXT_REGEXP);
|
|
11
|
+
if (!matches) {
|
|
12
12
|
return fallback(input, position);
|
|
13
13
|
}
|
|
14
|
-
match = trimBadEndChar(
|
|
14
|
+
const match = trimBadEndChar(matches);
|
|
15
15
|
|
|
16
16
|
// Remove mailto:
|
|
17
17
|
const textRepresentation = match[1] === 'mailto:' ? match[2] : match[0];
|
package/dist/es2019/version.json
CHANGED
|
@@ -6,11 +6,11 @@ export var linkText = function linkText(_ref) {
|
|
|
6
6
|
var input = _ref.input,
|
|
7
7
|
position = _ref.position,
|
|
8
8
|
schema = _ref.schema;
|
|
9
|
-
var
|
|
10
|
-
if (!
|
|
9
|
+
var matches = input.substring(position).match(LINK_TEXT_REGEXP);
|
|
10
|
+
if (!matches) {
|
|
11
11
|
return fallback(input, position);
|
|
12
12
|
}
|
|
13
|
-
match = trimBadEndChar(
|
|
13
|
+
var match = trimBadEndChar(matches);
|
|
14
14
|
|
|
15
15
|
// Remove mailto:
|
|
16
16
|
var textRepresentation = match[1] === 'mailto:' ? match[2] : match[0];
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Node as PMNode } from 'prosemirror-model';
|
|
2
2
|
import { Context } from '../interfaces';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type MarkEncoder = (text: string, attrs: any) => string;
|
|
4
|
+
export type NodeEncoder = (node: PMNode, opts?: NodeEncoderOpts) => string;
|
|
5
|
+
export type NodeEncoderOpts = {
|
|
6
6
|
parent?: PMNode;
|
|
7
7
|
context?: Context;
|
|
8
8
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Node as PMNode } from 'prosemirror-model';
|
|
2
2
|
import { Context } from '../../interfaces';
|
|
3
|
-
export declare const listItem: (node: PMNode, prefix: string, context?: Context
|
|
3
|
+
export declare const listItem: (node: PMNode, prefix: string, context?: Context) => string;
|
|
@@ -26,8 +26,8 @@ export interface List {
|
|
|
26
26
|
type: ListType;
|
|
27
27
|
parent?: ListItem;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
30
|
-
export
|
|
29
|
+
export type ListType = 'bulletList' | 'orderedList';
|
|
30
|
+
export type CellType = 'tableHeader' | 'tableCell';
|
|
31
31
|
export interface TableCell {
|
|
32
32
|
type: CellType;
|
|
33
33
|
content: PMNode[];
|
|
@@ -51,7 +51,7 @@ export interface MediaConversionMap {
|
|
|
51
51
|
embed?: boolean;
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
export
|
|
54
|
+
export type TokenErrCallback = (err: Error, tokenType: string) => void;
|
|
55
55
|
export interface Context {
|
|
56
56
|
readonly issueKeyRegex?: RegExp | undefined;
|
|
57
57
|
readonly tokenErrCallback?: TokenErrCallback;
|
|
@@ -44,9 +44,9 @@ export interface PMNodeToken {
|
|
|
44
44
|
readonly nodes: PMNode[];
|
|
45
45
|
readonly length: number;
|
|
46
46
|
}
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
47
|
+
export type TokenErrCallback = (err: Error, tokenType: string) => void;
|
|
48
|
+
export type Token = TextToken | PMNodeToken;
|
|
49
|
+
export type TokenParser = ({ input, position, schema, context, }: {
|
|
50
50
|
input: string;
|
|
51
51
|
position: number;
|
|
52
52
|
schema: Schema;
|
|
@@ -17,4 +17,4 @@ export interface Issue {
|
|
|
17
17
|
export declare const issueKey: TokenParser;
|
|
18
18
|
export declare const getIssue: (context: Context, key: string) => Issue | null;
|
|
19
19
|
export declare const buildInlineCard: (schema: Schema, issue: Issue) => PMNode[];
|
|
20
|
-
export declare const buildIssueKeyRegex: (inlineCardConversion?: ConversionMap
|
|
20
|
+
export declare const buildIssueKeyRegex: (inlineCardConversion?: ConversionMap) => RegExp | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EM_DASH = "\u2014";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Context } from '../interfaces';
|
|
3
|
+
export type MarkEncoder = (text: string, attrs: any) => string;
|
|
4
|
+
export type NodeEncoder = (node: PMNode, opts?: NodeEncoderOpts) => string;
|
|
5
|
+
export type NodeEncoderOpts = {
|
|
6
|
+
parent?: PMNode;
|
|
7
|
+
context?: Context;
|
|
8
|
+
};
|
|
9
|
+
export declare function encode(node: PMNode, context?: Context): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
import { Context } from './interfaces';
|
|
3
|
+
interface Transformer<T> {
|
|
4
|
+
encode(node: PMNode): T;
|
|
5
|
+
parse(content: T): PMNode;
|
|
6
|
+
}
|
|
7
|
+
export declare class WikiMarkupTransformer implements Transformer<string> {
|
|
8
|
+
private schema;
|
|
9
|
+
constructor(schema?: Schema);
|
|
10
|
+
private sanitizeWikiMarkup;
|
|
11
|
+
encode(node: PMNode, context?: Context): string;
|
|
12
|
+
parse(wikiMarkup: string, context?: Context): PMNode;
|
|
13
|
+
private buildContext;
|
|
14
|
+
}
|
|
15
|
+
export default WikiMarkupTransformer;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
export interface AddArgs {
|
|
3
|
+
style: string | null;
|
|
4
|
+
content: PMNode[];
|
|
5
|
+
}
|
|
6
|
+
export interface Builder {
|
|
7
|
+
type: string;
|
|
8
|
+
/**
|
|
9
|
+
* Add a item to the builder
|
|
10
|
+
* @param {AddCellArgs[]} items
|
|
11
|
+
*/
|
|
12
|
+
add(items: AddArgs[]): void;
|
|
13
|
+
/**
|
|
14
|
+
* Compile a prosemirror node from the root list
|
|
15
|
+
* @returns {PMNode}
|
|
16
|
+
*/
|
|
17
|
+
buildPMNode(): PMNode;
|
|
18
|
+
}
|
|
19
|
+
export interface ListItem {
|
|
20
|
+
content?: any[];
|
|
21
|
+
parent: List;
|
|
22
|
+
children: List[];
|
|
23
|
+
}
|
|
24
|
+
export interface List {
|
|
25
|
+
children: ListItem[];
|
|
26
|
+
type: ListType;
|
|
27
|
+
parent?: ListItem;
|
|
28
|
+
}
|
|
29
|
+
export type ListType = 'bulletList' | 'orderedList';
|
|
30
|
+
export type CellType = 'tableHeader' | 'tableCell';
|
|
31
|
+
export interface TableCell {
|
|
32
|
+
type: CellType;
|
|
33
|
+
content: PMNode[];
|
|
34
|
+
}
|
|
35
|
+
export interface TableRow {
|
|
36
|
+
cells: TableCell[];
|
|
37
|
+
}
|
|
38
|
+
export interface Table {
|
|
39
|
+
rows: TableRow[];
|
|
40
|
+
}
|
|
41
|
+
export interface AddCellArgs extends AddArgs {
|
|
42
|
+
style: string;
|
|
43
|
+
content: PMNode[];
|
|
44
|
+
}
|
|
45
|
+
export interface ConversionMap {
|
|
46
|
+
[key: string]: string;
|
|
47
|
+
}
|
|
48
|
+
export interface MediaConversionMap {
|
|
49
|
+
[key: string]: {
|
|
50
|
+
transform?: string;
|
|
51
|
+
embed?: boolean;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export type TokenErrCallback = (err: Error, tokenType: string) => void;
|
|
55
|
+
export interface Context {
|
|
56
|
+
readonly issueKeyRegex?: RegExp | undefined;
|
|
57
|
+
readonly tokenErrCallback?: TokenErrCallback;
|
|
58
|
+
readonly conversion?: {
|
|
59
|
+
readonly inlineCardConversion?: ConversionMap;
|
|
60
|
+
readonly mediaConversion?: MediaConversionMap;
|
|
61
|
+
mentionConversion?: ConversionMap;
|
|
62
|
+
};
|
|
63
|
+
readonly hydration?: {
|
|
64
|
+
readonly media?: {
|
|
65
|
+
targetCollectionId?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
readonly defaults?: {
|
|
69
|
+
readonly media?: {
|
|
70
|
+
width: number | null;
|
|
71
|
+
height: number | null;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
import { Context } from '../interfaces';
|
|
3
|
+
export default class AbstractTree {
|
|
4
|
+
private schema;
|
|
5
|
+
private wikiMarkup;
|
|
6
|
+
constructor(schema: Schema, wikiMarkup: string);
|
|
7
|
+
/**
|
|
8
|
+
* Convert reduced macros tree into prosemirror model tree
|
|
9
|
+
*/
|
|
10
|
+
getProseMirrorModel(context: Context): PMNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
import { AddArgs, ListType } from '../../interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Return the type of a list from the bullets
|
|
5
|
+
*/
|
|
6
|
+
export declare function getType(bullets: string): ListType;
|
|
7
|
+
export declare class ListBuilder {
|
|
8
|
+
private schema;
|
|
9
|
+
private root;
|
|
10
|
+
private lastDepth;
|
|
11
|
+
private lastList;
|
|
12
|
+
constructor(schema: Schema, bullets: string);
|
|
13
|
+
/**
|
|
14
|
+
* Return the type of the base list
|
|
15
|
+
* @returns {ListType}
|
|
16
|
+
*/
|
|
17
|
+
get type(): ListType;
|
|
18
|
+
/**
|
|
19
|
+
* Add a list item to the builder
|
|
20
|
+
* @param {AddArgs[]} items
|
|
21
|
+
*/
|
|
22
|
+
add(items: AddArgs[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Compile a prosemirror node from the root list
|
|
25
|
+
* @returns {PMNode[]}
|
|
26
|
+
*/
|
|
27
|
+
buildPMNode(): PMNode[];
|
|
28
|
+
/**
|
|
29
|
+
* Build prosemirror bulletList or orderedList node
|
|
30
|
+
* @param {List} list
|
|
31
|
+
* @returns {PMNode}
|
|
32
|
+
*/
|
|
33
|
+
private parseList;
|
|
34
|
+
/**
|
|
35
|
+
* Build prosemirror listItem node
|
|
36
|
+
* This function would possibly return non listItem nodes
|
|
37
|
+
* which we need to break out later
|
|
38
|
+
* @param {ListItem} item
|
|
39
|
+
*/
|
|
40
|
+
private parseListItem;
|
|
41
|
+
private isParagraphEmptyTextNode;
|
|
42
|
+
private createListItem;
|
|
43
|
+
/**
|
|
44
|
+
* Add an item at the same level as the current list item
|
|
45
|
+
* @param {ListType} type
|
|
46
|
+
* @param {PMNode} content
|
|
47
|
+
* @returns {PMNode}
|
|
48
|
+
*/
|
|
49
|
+
private addListItem;
|
|
50
|
+
/**
|
|
51
|
+
* Append the past content to the last accessed list node (multiline entries)
|
|
52
|
+
* @param {PMNode[]} content
|
|
53
|
+
*/
|
|
54
|
+
private appendToLastItem;
|
|
55
|
+
/**
|
|
56
|
+
* Created a nested list structure of N depth under the current node
|
|
57
|
+
* @param {number} depth
|
|
58
|
+
* @param {ListType} type
|
|
59
|
+
*/
|
|
60
|
+
private createNest;
|
|
61
|
+
/**
|
|
62
|
+
* Find the Nth list ancestor of the current list
|
|
63
|
+
* @param {number} depth
|
|
64
|
+
*/
|
|
65
|
+
private findAncestor;
|
|
66
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
import { AddCellArgs, Builder } from '../../interfaces';
|
|
3
|
+
export declare class TableBuilder implements Builder {
|
|
4
|
+
private schema;
|
|
5
|
+
private root;
|
|
6
|
+
private lastRow?;
|
|
7
|
+
constructor(schema: Schema);
|
|
8
|
+
/**
|
|
9
|
+
* Return the type of the base element
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
get type(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Add new cells to the table
|
|
15
|
+
* @param {AddCellArgs[]} cells
|
|
16
|
+
*/
|
|
17
|
+
add(cells: AddCellArgs[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Build a prosemirror table from the data
|
|
20
|
+
* @returns {PMNode}
|
|
21
|
+
*/
|
|
22
|
+
buildPMNode(): PMNode;
|
|
23
|
+
private emptyTableCell;
|
|
24
|
+
private emptyTableRow;
|
|
25
|
+
/**
|
|
26
|
+
* Build prosemirror table node
|
|
27
|
+
* @returns {PMNode}
|
|
28
|
+
*/
|
|
29
|
+
private buildTableNode;
|
|
30
|
+
/**
|
|
31
|
+
* Build prosemirror tr node
|
|
32
|
+
* @returns {PMNode}
|
|
33
|
+
*/
|
|
34
|
+
private buildTableRowNode;
|
|
35
|
+
/**
|
|
36
|
+
* Build prosemirror td/th node
|
|
37
|
+
* @param {TableCell} cell
|
|
38
|
+
* @returns {PMNode}
|
|
39
|
+
*/
|
|
40
|
+
private buildTableCellNode;
|
|
41
|
+
/**
|
|
42
|
+
* Add a new row to the table
|
|
43
|
+
*/
|
|
44
|
+
private addRow;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function error(message: string, _input: string, line: number, column: number): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
export declare function createEmptyParagraphNode(schema: Schema): PMNode;
|
|
3
|
+
/**
|
|
4
|
+
* Create paragraphs from inline nodes. Function will return
|
|
5
|
+
* an empty array in case only hardbreaks are present
|
|
6
|
+
*/
|
|
7
|
+
export declare function createParagraphNodeFromInlineNodes(inlineNodes: PMNode[], schema: Schema): PMNode[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
import { TokenType } from './tokenize';
|
|
3
|
+
import { Context } from '../interfaces';
|
|
4
|
+
export declare function parseString({ input, schema, ignoreTokenTypes, context, includeLeadingSpace, }: {
|
|
5
|
+
input: string;
|
|
6
|
+
schema: Schema;
|
|
7
|
+
ignoreTokenTypes: TokenType[];
|
|
8
|
+
context: Context;
|
|
9
|
+
includeLeadingSpace?: boolean;
|
|
10
|
+
}): PMNode[];
|