Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("can remove marks from nested nodes", () =>
rem(doc(p(em("one ", strong("<a>two<b>"), " three"))),
schema.mark("strong"),
doc(p(em("one two three")))))
</b></a>
it("should overwrite marks with different attributes", () =>
add(doc(p("this is a ", a("<a>link<b>"))),
schema.mark("link", {href: "bar"}),
doc(p("this is a ", a({href: "bar"}, "link")))))
</b></a>
it("can add a mark in a nested node", () =>
add(doc(p("before"), blockquote(p("the variable is called <a>i<b>")), p("after")),
schema.mark("code"),
doc(p("before"), blockquote(p("the variable is called ", code("i"))), p("after"))))
</b></a>
it("can remove across blocks", () =>
rem(doc(blockquote(p(em("much <a>em")), p(em("here too"))), p("between", em("...")), p(em("end<b>"))),
schema.mark("em"),
doc(blockquote(p(em("much "), "em"), p("here too")), p("between..."), p("end"))))
</b></a>
it("supports specifying and persisting storedMarks", () => {
let state = EditorState.create({doc: doc(p("ok")), storedMarks: [schema.mark("em")]})
ist(state.storedMarks.length, 1)
let copy = EditorState.fromJSON({schema}, state.toJSON())
ist(copy.storedMarks.length, 1)
})
it("draws the specified marks around a widget", () => {
let view = tempEditor({
doc: doc(p("foobar")),
plugins: [decoPlugin([Decoration.widget(4, document.createElement("img"), {marks: [schema.mark("em")]})])]
})
ist(view.dom.querySelector("em img"))
})
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")
let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")
let customSchema = new Schema({
nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
marks: {
remark: {attrs: {id: {}}, excludes: "", inclusive: false},
user: {attrs: {id: {}}, excludes: "_"},
strong: {excludes: "em-group"},
em: {group: "em-group"}
}
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
customEm = custom.em.create(), customStrong = custom.strong.create()
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")
let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")
let customSchema = new Schema({
nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
marks: {
remark: {attrs: {id: {}}, excludes: "", inclusive: false},
user: {attrs: {id: {}}, excludes: "_"},
strong: {excludes: "em-group"},
em: {group: "em-group"}
}
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
customEm = custom.em.create(), customStrong = custom.strong.create()
describe("Mark", () => {
describe("sameSet", () => {
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")
let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")
let customSchema = new Schema({
nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
marks: {
remark: {attrs: {id: {}}, excludes: "", inclusive: false},
user: {attrs: {id: {}}, excludes: "_"},
strong: {excludes: "em-group"},
em: {group: "em-group"}
}
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
customEm = custom.em.create(), customStrong = custom.strong.create()