json-joy
Version:
Collection of libraries for building collaborative editing apps.
257 lines (256 loc) • 7.9 kB
TypeScript
/**
* Specifies whether the start or the end of the cursor is the "anchor", e.g.
* the end which does not move when user changes selection. The other
* end is free to move, the moving end of the cursor is "focus". By default
* "anchor" is usually the start of the cursor.
*/
export declare enum CursorAnchor {
Start = 0,
End = 1
}
export declare const enum SliceTypeCon {
p = 0,// <p>
blockquote = 1,// <blockquote> (used by Quill)
codeblock = 2,// <code>
'code-block' = 3,// <code> (same as <codeblock>, used by Quill)
code_block = 4,// <code> (same as <codeblock>, used by Prosemirror)
pre = 5,// <pre>
ul = 6,// <ul>
ol = 7,// <ol>
tl = 8,// - [ ] Task list
li = 9,// <li>
list = 10,// A generic list (used by Quill)
h1 = 11,// <h1>
h2 = 12,// <h2>
h3 = 13,// <h3>
h4 = 14,// <h4>
h5 = 15,// <h5>
h6 = 16,// <h6>
heading = 17,// <heading level="3"> (same as <h3>)
header = 18,// <header level="3"> (same as <h3>, used by Quill)
title = 19,// <title> (whole document title)
subtitle = 20,// <subtitle> (whole document subtitle)
br = 21,// <br>
hard_break = 22,// Same as <br> (used by Prosemirror)
nl = 23,// \n
hr = 24,// <hr>
horizontal_rule = 25,// Same as <hr> (used by Prosemirror)
page = 26,// Page break
aside = 27,// <aside>
imgblock = 28,// <img> (image)
embed = 29,// <embed>, <iframe>, <object>, <video>, <audio>, etc.
column = 30,// <div style="column-count: ...">
contents = 31,// Table of contents
table = 32,// <table>
tr = 33,// <tr> (table row)
td = 34,// <td> (table cell)
cl = 35,// Collapsible list
collapse = 36,// Collapsible block
note = 37,// Note block
mathblock = 38,// <math> block
div = 39,// <div>
Cursor = -1,// Current user's cursors.
RemoteCursor = -2,// Remote collaborator cursors.
b = -3,// <b>
bold = -4,// <bold> (same as <b>, used in Slate and Quill)
strong = -5,// <strong> (similar to <b>, used in Prosemirror)
i = -6,// <i>
italic = -7,// <em> (same as <i>, used in Slate and Quill)
em = -8,// <em> (similar to <i>, used in Prosemirror)
u = -9,// <u>
underline = -10,// <underline> (same as <u>, used in Slate and Quill)
overline = -11,// <span style="text-decoration: overline">
s = -12,// <s>
strike = -13,// <strike> (same as <s>, used by Quill)
strikethrough = -14,// <strikethrough> (same as <s>)
code = -15,// <code>
mark = -16,// <mark>
a = -17,// <a>
link = -18,// <link> (same as <a>, used in Prosemirror and Quill)
img = -19,// inline <img>
image = -20,// <image> (same as <img>, used in Quill)
comment = -21,// User comment attached to a slice
del = -22,// <del>
ins = -23,// <ins>
sup = -24,// <sup>
sub = -25,// <sub>
script = -26,// { script: 'sub' | 'sup' } (used in Quill)
math = -27,// <math> inline
font = -28,// <span style="font-family: ..."> (used in Quill)
col = -29,// <span style="color: ...">
color = -30,// Same as col, used by Quill
bg = -31,// <span style="background: ...">
background = -32,// Same as bg, used by Quill
kbd = -33,// <kbd>
spoiler = -34,// <span style="color: transparent; background: black">
q = -35,// <q> (inline quote)
cite = -36,// <cite> (inline citation)
footnote = -37,// <sup> or <a> with href="#footnote-..." and title="Footnote ..."
ref = -38,// <a> with href="#ref-..." and title="Reference ..." (Reference to some element in the document)
iaside = -39,// Inline <aside>
iembed = -40,// inline embed (any media, dropdown, Google Docs-like chips: date, person, file, etc.)
bookmark = -41
}
/**
* All type name must be fully lowercase, as HTML custom element tag names must
* be lowercase.
*/
export declare enum SliceTypeName {
p = 0,
blockquote = 1,
codeblock = 2,
'code-block' = 3,
code_block = 4,
pre = 5,
ul = 6,
ol = 7,
tl = 8,
li = 9,
list = 10,
h1 = 11,
h2 = 12,
h3 = 13,
h4 = 14,
h5 = 15,
h6 = 16,
heading = 17,
header = 18,
title = 19,
subtitle = 20,
br = 21,
hard_break = 22,
nl = 23,
hr = 24,
horizontal_rule = 25,
page = 26,
aside = 27,
imgblock = 28,
embed = 29,
column = 30,
contents = 31,
table = 32,
tr = 33,
td = 34,
cl = 35,
collapse = 36,
note = 37,
mathblock = 38,
div = 39,
Cursor = -1,
RemoteCursor = -2,
b = -3,
bold = -4,
strong = -5,
i = -6,
italic = -7,
em = -8,
u = -9,
underline = -10,
overline = -11,
s = -12,
strike = -13,
strikethrough = -14,
code = -15,
mark = -16,
a = -17,
link = -18,
img = -19,
image = -20,
comment = -21,
del = -22,
ins = -23,
sup = -24,
sub = -25,
script = -26,
math = -27,
font = -28,
col = -29,
color = -30,
bg = -31,
background = -32,
kbd = -33,
spoiler = -34,
q = -35,
cite = -36,
footnote = -37,
ref = -38,
iaside = -39,
iembed = -40,
bookmark = -41
}
/** Slice header octet (8 bits) masking specification. */
export declare enum SliceHeaderMask {
/** The {@link Anchor} of the slice start {@link Point}. */
X1Anchor = 1,
/** The {@link Anchor} of the slice end {@link Point}. */
X2Anchor = 2,
/** Slice stacking behavior, one of {@link SliceStacking}. */
Stacking = 28
}
export declare enum SliceHeaderShift {
X1Anchor = 0,
X2Anchor = 1,
Stacking = 2
}
export declare enum SliceStacking {
/**
* The `Marker` slices are used to mark a block split position in the
* document. For example, paragraph, heading, blockquote, etc. It separates
* adjacent blocks and is used to determine the block type of the contents
* following the marker, until the next marker is encountered.
*/
Marker = 0,
/**
* The `Many` slices are inline formatting annotations, which allow one
* or more annotations of the same type to apply to the same text. Slices with
* stacking behavior `Many` are appended to the stack of attributes for a
* specific slice type. With the most recent annotation on top.
*
* Slices with stacking behavior `Many` are used for inline formatting, like
* for links, comments, etc. Where multiple annotations of the same type can
* be applied to the same text.
*/
Many = 1,
/**
* The slices with stacking behavior `One` are used for inline formatting
* annotations, they overwrite the stack of attributes for a specific slice
* type. This type of slice is used when only one annotation of a specific
* type can be applied to the same text. For example, those could be used
* for simple inline formatting, like bold, italic, etc.
*/
One = 2,
/**
* The `Erase` slices are used to soft remove all annotations
* (`Many` or `One`) of the same type which are applied to the same text
* range. The erase slices soft remove only the annotations which were applied
* before the erase slice, as determined by the logical clock (there could
* be many layers of annotations applied and erased).
*
* Usually slices with stacking behavior `Erase` are used to reverse inline
* exclusive (`One`) inline formatting, like bold, italic, etc.
*/
Erase = 3,
/**
* Used to mark the user's cursor position in the document.
*
* @todo Consider removing this.
*/
Cursor = 4
}
export declare enum SliceStackingName {
Marker = 0,
Many = 1,
One = 2,
Erase = 3,
Cursor = 4
}
/**
* Specifies `vec` offsets in the {@link SliceView}.
*/
export declare enum SliceTupleIndex {
Header = 0,
X1 = 1,
X2 = 2,
Type = 3,
Data = 4
}