docs: update content
This commit is contained in:
@@ -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.
|
Have a look at all of the core commands listed below. They should give you a good first impression of what’s possible.
|
||||||
|
|
||||||
### Content
|
### Content
|
||||||
| Command | Description | Links |
|
| Command | Description | Links |
|
||||||
| ---------------- | -------------------------------------------------------- | ------------------------------------ |
|
| ------------------ | -------------------------------------------------------- | --------------------------------------- |
|
||||||
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
| .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) |
|
| .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) |
|
| .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
|
### Nodes & Marks
|
||||||
| Command | Description | Links |
|
| 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) |
|
| .lift() | Removes an existing wrap. | [More](/api/commands/lift) |
|
||||||
| .liftEmptyBlock() | Lift block if empty. | [More](/api/commands/lift-empty-block) |
|
| .liftEmptyBlock() | Lift block if empty. | [More](/api/commands/lift-empty-block) |
|
||||||
| .newlineInCode() | Add a newline character in code. | [More](/api/commands/newline-in-code) |
|
| .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) |
|
| .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) |
|
| .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) |
|
| .setNode() | Replace a given range with a node. | [More](/api/commands/set-node) |
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# replaceRange
|
# insertContentAt
|
||||||
|
|
||||||
<ContentMissing />
|
<ContentMissing />
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# replace
|
|
||||||
|
|
||||||
<ContentMissing />
|
|
||||||
@@ -157,6 +157,9 @@
|
|||||||
type: draft
|
type: draft
|
||||||
- title: insertContent
|
- title: insertContent
|
||||||
link: /api/commands/insert-content
|
link: /api/commands/insert-content
|
||||||
|
- title: insertContentAt
|
||||||
|
link: /api/commands/insert-content-at
|
||||||
|
type: draft
|
||||||
- title: joinBackward
|
- title: joinBackward
|
||||||
link: /api/commands/join-backward
|
link: /api/commands/join-backward
|
||||||
type: draft
|
type: draft
|
||||||
@@ -178,12 +181,6 @@
|
|||||||
- title: newlineInCode
|
- title: newlineInCode
|
||||||
link: /api/commands/newline-in-code
|
link: /api/commands/newline-in-code
|
||||||
type: draft
|
type: draft
|
||||||
- title: replaceRange
|
|
||||||
link: /api/commands/replace-range
|
|
||||||
type: draft
|
|
||||||
- title: replace
|
|
||||||
link: /api/commands/replace
|
|
||||||
type: draft
|
|
||||||
- title: resetAttributes
|
- title: resetAttributes
|
||||||
link: /api/commands/reset-attributes
|
link: /api/commands/reset-attributes
|
||||||
type: draft
|
type: draft
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ declare module '@tiptap/core' {
|
|||||||
interface Commands {
|
interface Commands {
|
||||||
insertContentAt: {
|
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,
|
insertContentAt: (range: Range, value: Content) => Command,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ declare module '@tiptap/core' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const replace: RawCommands['replace'] = (typeOrName, attributes = {}) => ({ state, commands }) => {
|
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 { from, to } = state.selection
|
||||||
const range = { from, to }
|
const range = { from, to }
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ declare module '@tiptap/core' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const replaceRange: RawCommands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
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 type = getNodeType(typeOrName, state.schema)
|
||||||
const { from, to } = range
|
const { from, to } = range
|
||||||
// const $from = tr.doc.resolve(from)
|
// const $from = tr.doc.resolve(from)
|
||||||
|
|||||||
Reference in New Issue
Block a user