Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension documentation #107

Open
Leecason opened this issue Jun 8, 2020 · 27 comments
Open

Extension documentation #107

Leecason opened this issue Jun 8, 2020 · 27 comments
Labels

Comments

@Leecason Leecason added the docs label Jun 8, 2020
@Leecason
Copy link
Owner Author

Necessary extensions

Doc

Must be introduced in the first

Usage

new Doc({
  title: true,
})

options

title

Whether the title mode is enabled. Default to false, if true, needs to introduce Title extension.

Paragraph

Usage

new Paragraph()

Text

Usage

new Text()

@Leecason
Copy link
Owner Author

Heading

Usage

new Heading({
  level: 5
});

options

level

the max level of heading

@Leecason
Copy link
Owner Author

Bold

Usage

new Bold()

@Leecason
Copy link
Owner Author

Italic

Usage

new Italic()

@Leecason
Copy link
Owner Author

Underline

Usage

new Underline()

@Leecason
Copy link
Owner Author

Strike

Usage

new Strike()

@Leecason
Copy link
Owner Author

Code

Usage

new Code()

@Leecason
Copy link
Owner Author

CodeBlock

Usage

new CodeBlock()

@Leecason
Copy link
Owner Author

Blockquote

Usage

new Blockquote()

@Leecason
Copy link
Owner Author

Link

Usage

new Link()

@Leecason
Copy link
Owner Author

Leecason commented Jun 10, 2020

Image

Usage

new Image({
  urlPattern: 
  uploadRequest:
})

options

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

@Leecason
Copy link
Owner Author

Leecason commented Jun 11, 2020

BulletList(use with ListItem)

Usage

new BulletList()

OrdererList(use with ListItem)

Usage

new OrderedList()

ListItem

Usage

new ListItem()

@Leecason
Copy link
Owner Author

Leecason commented Jun 11, 2020

TodoList (use with TodoItem)

Usage

new TodoList()

TodoItem

Usage

new TodoItem()

@Leecason
Copy link
Owner Author

Iframe

Usage

new Iframe()

@Leecason
Copy link
Owner Author

Table (use with TableHeader, TableCell, TableRow)

Usage

new Table({
  resizable: true
});

options

resizable

Whether table cell can be resized (Default to false)

TableHeader

Usage

new TableHeader();

TableRow

Usage

new TableRow();

TableCell

Usage

new TableCell();

@Leecason
Copy link
Owner Author

TextAlign

Usage

new TextAlign({
  alignments: ['left', 'center', 'right', 'justify'],
})

options

alignments

Available alignment, the order will affect the render order for the menu buttons.
Default to ['left', 'center', 'right', 'justify']

@Leecason
Copy link
Owner Author

LineHeight

Usage

new LineHeight({
  lineHeights: ['100%', '200%', '300%']
});

options

lineHeights

Available line heights, the order will affect the render order for the menu buttons.
Default to ['100%', '115%', '150%', '200%', '250%', '300%']

@Leecason
Copy link
Owner Author

Indent

Usage

new Indent({
  minIndent: 0,
  maxIndent: 7,
});

options

minIndentmaxIndent

Per indent step is 30px

@Leecason
Copy link
Owner Author

HorizontalRule

Usage

new HorizontalRule();

HardBreak

Usage

new HardBreak();

TrailingNode

Usage

new TrailingNode();

@Leecason
Copy link
Owner Author

History

Usage

new History();

@Leecason
Copy link
Owner Author

TextColor

Usage

new TextColor({
  colors: [...]
});

options

colors

Available colors. Default color set: https://github.com/Leecason/element-tiptap/blob/master/src/utils/color.ts#L6

TextHighlight

Usage

new TextHighlight({
  colors: [...]
});

options

colors

Available colors. Default color set: https://github.com/Leecason/element-tiptap/blob/master/src/utils/color.ts#L6

@Leecason
Copy link
Owner Author

FormatClear

Usage

new FormatClear();

@Leecason
Copy link
Owner Author

FontType

Usage

new FontType({
  fontTypes: {
    name: css_font_family_value,
  }
});

options

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

Usage

new FontSize({
  fontSizes: ['8', '10', ...]
});

options

fontSizes

Available fontSizes.
Default fontSizes: ['8', '10', '12', '14', '16', '18', '20', '24', '30', '36', '48', '60', '72']

@Leecason
Copy link
Owner Author

Preview

Usage

new Preview();

Print

Usage

new Print();

Fullscreen

Usage

new Fullscreen();

SelectAll

Usage

new SelectAll();

@Leecason
Copy link
Owner Author

CodeView

An extension to view and edit HTML source code.

❗This extension requires the codemirror library, please install codemirror in your project.❗

Usage

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

Example

https://github.com/Leecason/element-tiptap/pull/106/files#diff-f46d3cf30b935a3e6aaa63e4ce7dbeb6

@Leecason Leecason changed the title Extension docs Extension documentation Jun 11, 2020
@JiaWenjie1001
Copy link

Link extension how to add placeholder?

1 similar comment
@JiaWenjie1001
Copy link

Link extension how to add placeholder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants