Open Leecason opened 4 years ago
Doc
Must be introduced in the first
new Doc({
title: true,
})
title
Whether the title mode is enabled. Default to false
, if true
, needs to introduce Title
extension.
Paragraph
new Paragraph()
Text
new Text()
Heading
new Heading({
level: 5
});
level
the max level of heading
Bold
new Bold()
Italic
new Italic()
Underline
new Underline()
Strike
new Strike()
Code
new Code()
CodeBlock
new CodeBlock()
Blockquote
new Blockquote()
Link
new Link()
Image
new Image({
urlPattern:
uploadRequest:
})
urlPattern
check image url valid when insert external image.
Default:
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/
uploadRequest
custom image upload method, the method should return Promise<url>
.
default value is a method that return base64 data of image
BulletList
(use with ListItem
)new BulletList()
OrdererList
(use with ListItem
)new OrderedList()
ListItem
new ListItem()
TodoList
(use with TodoItem
)new TodoList()
TodoItem
new TodoItem()
Iframe
new Iframe()
Table
(use with TableHeader
, TableCell
, TableRow
)new Table({
resizable: true
});
resizable
Whether table cell can be resized (Default to false)
TableHeader
new TableHeader();
TableRow
new TableRow();
TableCell
new TableCell();
TextAlign
new TextAlign({
alignments: ['left', 'center', 'right', 'justify'],
})
alignments
Available alignment, the order will affect the render order for the menu buttons. Default to ['left', 'center', 'right', 'justify']
LineHeight
new LineHeight({
lineHeights: ['100%', '200%', '300%']
});
lineHeights
Available line heights, the order will affect the render order for the menu buttons. Default to ['100%', '115%', '150%', '200%', '250%', '300%']
Indent
new Indent({
minIndent: 0,
maxIndent: 7,
});
minIndent、maxIndent
Per indent step is 30px
HorizontalRule
new HorizontalRule();
HardBreak
new HardBreak();
TrailingNode
new TrailingNode();
History
new History();
TextColor
new TextColor({
colors: [...]
});
colors
Available colors. Default color set: https://github.com/Leecason/element-tiptap/blob/master/src/utils/color.ts#L6
TextHighlight
new TextHighlight({
colors: [...]
});
colors
Available colors. Default color set: https://github.com/Leecason/element-tiptap/blob/master/src/utils/color.ts#L6
FormatClear
new FormatClear();
FontType
new FontType({
fontTypes: {
name: css_font_family_value,
}
});
fontTypes
Available fontTypes. Default fontTypes:
{
'Arial': 'Arial',
'Arial Black': 'Arial Black',
'Georgia': 'Georgia',
'Impact': 'Impact',
'Tahoma': 'Tahoma',
'Times New Roman': 'Times New Roman',
'Verdana': 'Verdana',
'Courier New': 'Courier New',
'Lucida Console': 'Lucida Console',
'Monaco': 'Monaco',
'monospace': 'monospace',
}
FontSize
new FontSize({
fontSizes: ['8', '10', ...]
});
fontSizes
Available fontSizes.
Default fontSizes: ['8', '10', '12', '14', '16', '18', '20', '24', '30', '36', '48', '60', '72']
Preview
new Preview();
Print
new Print();
Fullscreen
new Fullscreen();
SelectAll
new SelectAll();
CodeView
An extension to view and edit HTML source code.
❗This extension requires the codemirror
library, please install codemirror
in your project.❗
import { CodeView } from 'element-tiptap';
import codemirror from 'codemirror'; // install 'codemirror' in your own project
import 'codemirror/lib/codemirror.css'; // import base style
import 'codemirror/mode/xml/xml.js'; // language
data () {
return {
extensions: [
...
new CodeView({
codemirror: // the CodeMirror library.
codemirrorOptions: // specify the options for CodeMirror.
}),
],
};
}
default codemirrorOptions
:
{
lineNumbers: true,
lineWrapping: true,
tabSize: 2,
tabMode: 'indent',
mode: 'text/html',
}
check more codemirror options
https://github.com/Leecason/element-tiptap/pull/106/files#diff-f46d3cf30b935a3e6aaa63e4ce7dbeb6
Link extension how to add placeholder?
Link extension how to add placeholder?
documentation for extensions
TODO: in README or docs site
Doc
,Paragraph
,Text
Heading
Bold
Italic
Underline
Strike
Code
CodeBlock
Blockquote
Link
Image
BulletList
,OrderedList
,ListItem
TodoList
,TodoItem
Iframe
Table
,TableHeader
,TableRow
,TableCell
TextAlign
LineHeight
Indent
HorizontalRule
,HardBreak
,TrailingNode
History
TextColor
,TextHighlight
FormatClear
FontType
,FontSize
Preview
,Print
,Fullscreen
,SelectAll
CodeView