Merge branch 'main' of github.com:ueberdosis/tiptap
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
npm run lint:fix
|
npm run lint:staged
|
||||||
|
|||||||
3
.lintstagedrc.js
Normal file
3
.lintstagedrc.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
"./**/*.{ts,tsx,js,jsx,vue}": ["eslint --fix --quiet --no-error-on-unmatched-pattern"],
|
||||||
|
};
|
||||||
875
package-lock.json
generated
875
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@
|
|||||||
"start": "npm --prefix ./demos run start",
|
"start": "npm --prefix ./demos run start",
|
||||||
"lint": "eslint --quiet --no-error-on-unmatched-pattern ./",
|
"lint": "eslint --quiet --no-error-on-unmatched-pattern ./",
|
||||||
"lint:fix": "eslint --fix --quiet --no-error-on-unmatched-pattern ./",
|
"lint:fix": "eslint --fix --quiet --no-error-on-unmatched-pattern ./",
|
||||||
|
"lint:staged": "lint-staged",
|
||||||
"test:open": "cypress open --project tests",
|
"test:open": "cypress open --project tests",
|
||||||
"test": "cypress run --project tests",
|
"test": "cypress run --project tests",
|
||||||
"build:demos": "npm --prefix ./demos run build",
|
"build:demos": "npm --prefix ./demos run build",
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
"eslint-plugin-vue": "^9.1.0",
|
"eslint-plugin-vue": "^9.1.0",
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
|
"lint-staged": "^13.0.3",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"rollup": "^2.67.0",
|
"rollup": "^2.67.0",
|
||||||
"rollup-plugin-auto-external": "^2.0.0",
|
"rollup-plugin-auto-external": "^2.0.0",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ParseOptions } from 'prosemirror-model'
|
import { ParseOptions } from 'prosemirror-model'
|
||||||
import { TextSelection } from 'prosemirror-state'
|
|
||||||
|
|
||||||
import { createDocument } from '../helpers/createDocument'
|
import { createDocument } from '../helpers/createDocument'
|
||||||
import { Content, RawCommands } from '../types'
|
import { Content, RawCommands } from '../types'
|
||||||
@@ -22,11 +21,9 @@ declare module '@tiptap/core' {
|
|||||||
export const setContent: RawCommands['setContent'] = (content, emitUpdate = false, parseOptions = {}) => ({ tr, editor, dispatch }) => {
|
export const setContent: RawCommands['setContent'] = (content, emitUpdate = false, parseOptions = {}) => ({ tr, editor, dispatch }) => {
|
||||||
const { doc } = tr
|
const { doc } = tr
|
||||||
const document = createDocument(content, editor.schema, parseOptions)
|
const document = createDocument(content, editor.schema, parseOptions)
|
||||||
const selection = TextSelection.create(doc, 0, doc.content.size)
|
|
||||||
|
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
tr.setSelection(selection)
|
tr.replaceWith(0, doc.content.size, document)
|
||||||
.replaceSelectionWith(document, false)
|
|
||||||
.setMeta('preventUpdate', !emitUpdate)
|
.setMeta('preventUpdate', !emitUpdate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const getTextContentFromNodes = ($from: ResolvedPos, maxMatch = 500) => {
|
|||||||
(node, pos, parent, index) => {
|
(node, pos, parent, index) => {
|
||||||
textBefore += node.type.spec.toText?.({
|
textBefore += node.type.spec.toText?.({
|
||||||
node, pos, parent, index,
|
node, pos, parent, index,
|
||||||
}) || node.textContent || '%leaf%'
|
}) || $from.nodeBefore?.text || '%leaf%'
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user