@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
22 lines • 473 B
JavaScript
import { parseNewlineOnly } from './whitespace';
export const hardbreak = ({
input,
position,
schema
}) => {
// Look for normal hardbreak \r, \n, \r\n
const length = parseNewlineOnly(input.substring(position));
if (length === 0) {
// not a valid hardbreak
return {
type: 'text',
text: input.substr(position, 1),
length: 1
};
}
return {
type: 'pmnode',
nodes: [schema.nodes.hardBreak.createChecked()],
length
};
};