@atlaskit/editor-wikimarkup-transformer
Version:
Wiki markup transformer for JIRA and Confluence
21 lines • 545 B
JavaScript
import { parseNewlineOnly } from './whitespace';
export var hardbreak = function hardbreak(_ref) {
var input = _ref.input,
position = _ref.position,
schema = _ref.schema;
// Look for normal hardbreak \r, \n, \r\n
var 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: length
};
};