mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 04:19:02 +08:00
docs: update content
This commit is contained in:
parent
55d430ef8f
commit
0030f083b0
@ -154,11 +154,12 @@ export default () => ({ commands }) => {
|
||||
Have a look at all of the core commands listed below. They should give you a good first impression of what’s possible.
|
||||
|
||||
### Content
|
||||
| Command | Description | Links |
|
||||
| ---------------- | -------------------------------------------------------- | ------------------------------------ |
|
||||
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
||||
| .insertContent() | Insert a node or string of HTML at the current position. | [More](/api/commands/insert-content) |
|
||||
| .setContent() | Replace the whole document with new content. | [More](/api/commands/set-content) |
|
||||
| Command | Description | Links |
|
||||
| ------------------ | -------------------------------------------------------- | --------------------------------------- |
|
||||
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
||||
| .insertContent() | Insert a node or string of HTML at the current position. | [More](/api/commands/insert-content) |
|
||||
| .insertContentAt() | Insert a node or string of HTML at a specific position. | [More](/api/commands/insert-content-at) |
|
||||
| .setContent() | Replace the whole document with new content. | [More](/api/commands/set-content) |
|
||||
|
||||
### Nodes & Marks
|
||||
| Command | Description | Links |
|
||||
@ -172,8 +173,6 @@ Have a look at all of the core commands listed below. They should give you a goo
|
||||
| .lift() | Removes an existing wrap. | [More](/api/commands/lift) |
|
||||
| .liftEmptyBlock() | Lift block if empty. | [More](/api/commands/lift-empty-block) |
|
||||
| .newlineInCode() | Add a newline character in code. | [More](/api/commands/newline-in-code) |
|
||||
| .replace() | Replaces text with a node. | [More](/api/commands/replace) |
|
||||
| .replaceRange() | Replaces text with a node within a range. | [More](/api/commands/replace-range) |
|
||||
| .resetAttributes() | Resets some node or mark attributes to the default value. | [More](/api/commands/reset-attributes) |
|
||||
| .setMark() | Add a mark with new attributes. | [More](/api/commands/set-mark) |
|
||||
| .setNode() | Replace a given range with a node. | [More](/api/commands/set-node) |
|
||||
|
@ -1,3 +1,3 @@
|
||||
# replaceRange
|
||||
# insertContentAt
|
||||
|
||||
<ContentMissing />
|
@ -1,3 +0,0 @@
|
||||
# replace
|
||||
|
||||
<ContentMissing />
|
@ -157,6 +157,9 @@
|
||||
type: draft
|
||||
- title: insertContent
|
||||
link: /api/commands/insert-content
|
||||
- title: insertContentAt
|
||||
link: /api/commands/insert-content-at
|
||||
type: draft
|
||||
- title: joinBackward
|
||||
link: /api/commands/join-backward
|
||||
type: draft
|
||||
@ -178,12 +181,6 @@
|
||||
- title: newlineInCode
|
||||
link: /api/commands/newline-in-code
|
||||
type: draft
|
||||
- title: replaceRange
|
||||
link: /api/commands/replace-range
|
||||
type: draft
|
||||
- title: replace
|
||||
link: /api/commands/replace
|
||||
type: draft
|
||||
- title: resetAttributes
|
||||
link: /api/commands/reset-attributes
|
||||
type: draft
|
||||
|
@ -11,7 +11,7 @@ declare module '@tiptap/core' {
|
||||
interface Commands {
|
||||
insertContentAt: {
|
||||
/**
|
||||
* Insert a node or string of HTML at the current position.
|
||||
* Insert a node or string of HTML at a specific position.
|
||||
*/
|
||||
insertContentAt: (range: Range, value: Content) => Command,
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ declare module '@tiptap/core' {
|
||||
}
|
||||
|
||||
export const replace: RawCommands['replace'] = (typeOrName, attributes = {}) => ({ state, commands }) => {
|
||||
console.warn('[tiptap warn]: replace() is deprecated. please use insertContent() instead.')
|
||||
|
||||
const { from, to } = state.selection
|
||||
const range = { from, to }
|
||||
|
||||
|
@ -14,6 +14,8 @@ declare module '@tiptap/core' {
|
||||
}
|
||||
|
||||
export const replaceRange: RawCommands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
||||
console.warn('[tiptap warn]: replaceRange() is deprecated. please use insertContent() instead.')
|
||||
|
||||
const type = getNodeType(typeOrName, state.schema)
|
||||
const { from, to } = range
|
||||
// const $from = tr.doc.resolve(from)
|
||||
|
Loading…
Reference in New Issue
Block a user