Fix typo in text-serializers-from-schema function
This commit is contained in:
committed by
Dominik
parent
155955c9a9
commit
819622c202
@@ -13,7 +13,7 @@ import { getHTMLFromFragment } from './helpers/getHTMLFromFragment'
|
|||||||
import { getText } from './helpers/getText'
|
import { getText } from './helpers/getText'
|
||||||
import { isNodeEmpty } from './helpers/isNodeEmpty'
|
import { isNodeEmpty } from './helpers/isNodeEmpty'
|
||||||
import { resolveFocusPosition } from './helpers/resolveFocusPosition'
|
import { resolveFocusPosition } from './helpers/resolveFocusPosition'
|
||||||
import { getTextSeralizersFromSchema } from './helpers/getTextSeralizersFromSchema'
|
import { getTextSerializersFromSchema } from './helpers/getTextSerializersFromSchema'
|
||||||
import { createStyleTag } from './utilities/createStyleTag'
|
import { createStyleTag } from './utilities/createStyleTag'
|
||||||
import { isFunction } from './utilities/isFunction'
|
import { isFunction } from './utilities/isFunction'
|
||||||
import { CommandManager } from './CommandManager'
|
import { CommandManager } from './CommandManager'
|
||||||
@@ -436,7 +436,7 @@ export class Editor extends EventEmitter<EditorEvents> {
|
|||||||
blockSeparator,
|
blockSeparator,
|
||||||
textSerializers: {
|
textSerializers: {
|
||||||
...textSerializers,
|
...textSerializers,
|
||||||
...getTextSeralizersFromSchema(this.schema),
|
...getTextSerializersFromSchema(this.schema),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Plugin, PluginKey } from 'prosemirror-state'
|
import { Plugin, PluginKey } from 'prosemirror-state'
|
||||||
import { Extension } from '../Extension'
|
import { Extension } from '../Extension'
|
||||||
import { getTextBetween } from '../helpers/getTextBetween'
|
import { getTextBetween } from '../helpers/getTextBetween'
|
||||||
import { getTextSeralizersFromSchema } from '../helpers/getTextSeralizersFromSchema'
|
import { getTextSerializersFromSchema } from '../helpers/getTextSerializersFromSchema'
|
||||||
|
|
||||||
export const ClipboardTextSerializer = Extension.create({
|
export const ClipboardTextSerializer = Extension.create({
|
||||||
name: 'clipboardTextSerializer',
|
name: 'clipboardTextSerializer',
|
||||||
@@ -18,7 +18,7 @@ export const ClipboardTextSerializer = Extension.create({
|
|||||||
const { ranges } = selection
|
const { ranges } = selection
|
||||||
const from = Math.min(...ranges.map(range => range.$from.pos))
|
const from = Math.min(...ranges.map(range => range.$from.pos))
|
||||||
const to = Math.max(...ranges.map(range => range.$to.pos))
|
const to = Math.max(...ranges.map(range => range.$to.pos))
|
||||||
const textSerializers = getTextSeralizersFromSchema(schema)
|
const textSerializers = getTextSerializersFromSchema(schema)
|
||||||
const range = { from, to }
|
const range = { from, to }
|
||||||
|
|
||||||
return getTextBetween(doc, range, {
|
return getTextBetween(doc, range, {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Node } from 'prosemirror-model'
|
import { Node } from 'prosemirror-model'
|
||||||
import { getSchema } from './getSchema'
|
import { getSchema } from './getSchema'
|
||||||
import { Extensions, JSONContent, TextSerializer } from '../types'
|
import { Extensions, JSONContent, TextSerializer } from '../types'
|
||||||
import { getTextSeralizersFromSchema } from './getTextSeralizersFromSchema'
|
import { getTextSerializersFromSchema } from './getTextSerializersFromSchema'
|
||||||
import { getText } from './getText'
|
import { getText } from './getText'
|
||||||
|
|
||||||
export function generateText(
|
export function generateText(
|
||||||
@@ -23,7 +23,7 @@ export function generateText(
|
|||||||
blockSeparator,
|
blockSeparator,
|
||||||
textSerializers: {
|
textSerializers: {
|
||||||
...textSerializers,
|
...textSerializers,
|
||||||
...getTextSeralizersFromSchema(schema),
|
...getTextSerializersFromSchema(schema),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Schema } from 'prosemirror-model'
|
import { Schema } from 'prosemirror-model'
|
||||||
import { TextSerializer } from '../types'
|
import { TextSerializer } from '../types'
|
||||||
|
|
||||||
export function getTextSeralizersFromSchema(schema: Schema): Record<string, TextSerializer> {
|
export function getTextSerializersFromSchema(schema: Schema): Record<string, TextSerializer> {
|
||||||
return Object.fromEntries(Object
|
return Object.fromEntries(Object
|
||||||
.entries(schema.nodes)
|
.entries(schema.nodes)
|
||||||
.filter(([, node]) => node.spec.toText)
|
.filter(([, node]) => node.spec.toText)
|
||||||
@@ -47,7 +47,7 @@ export * from './helpers/getNodeAttributes'
|
|||||||
export * from './helpers/getNodeType'
|
export * from './helpers/getNodeType'
|
||||||
export * from './helpers/getText'
|
export * from './helpers/getText'
|
||||||
export * from './helpers/getTextBetween'
|
export * from './helpers/getTextBetween'
|
||||||
export * from './helpers/getTextSeralizersFromSchema'
|
export * from './helpers/getTextSerializersFromSchema'
|
||||||
export * from './helpers/isActive'
|
export * from './helpers/isActive'
|
||||||
export * from './helpers/isList'
|
export * from './helpers/isList'
|
||||||
export * from './helpers/isMarkActive'
|
export * from './helpers/isMarkActive'
|
||||||
|
|||||||
Reference in New Issue
Block a user