Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const deserializeCode = (opts, text) => {
const sep = detectNewline(text) || DEFAULT_NEWLINE
const lines = List(text.split(sep)).map((line) =>
Block.create({
type: opts.line,
nodes: [Text.create(line)],
}),
)
const code = Block.create({
type: opts.block,
nodes: lines,
})
return code
}
const lines = List(text.split(sep)).map((line) =>
Block.create({
type: opts.line,
nodes: [Text.create(line)],
}),
)
const createBlock = (block) => {
let { type } = block;
const { isVoid, key, kind, data } = block;
if (!type) {
type = key;
}
if (kind === 'inline' || (!kind && isVoid)) {
return Inline.create({
type,
isVoid,
kind,
data: data || {},
});
}
return Block.create({
type,
isVoid,
kind,
data: data || {},
});
};
export default addBlock;
function makeEmptyRow(opts: Options): Block {
return Block.create({
type: opts.typeRow,
nodes: List([makeEmptyCell(opts)])
});
}
const createEmptyRawDoc = () => {
const emptyText = Text.create('');
const emptyBlock = Block.create({ object: 'block', type: 'paragraph', nodes: [emptyText] });
return { nodes: [emptyBlock] };
};
return () =>
Block.create({
kind: 'block',
type: options.TYPE,
nodes: [
Block.create({
kind: 'block',
type: headerModule.TYPE,
}),
articleGroupModule.helpers.newItem(),
],
})
}
const infoBoxButtonClickHandler = (value, onChange) => event => {
event.preventDefault()
return onChange(
value
.change()
.call(
injectBlock,
Block.create({
type: TYPE,
nodes: [
Block.create(titleModule.TYPE),
Block.create(paragraphModule.TYPE)
]
})
)
)
}
const insertTypes = editorOptions.insertTypes || []
normalize: (transform, document) => {
const block = Block.create(DEFAULT_BLOCK);
transform.insertNodeByKey(document.key, document.nodes.size, block);
},
},
export const getNewBlock = options => () => {
const [teaserModule] = options.subModules
return Block.create({
type: options.TYPE,
nodes: [
teaserModule.helpers.newItem(),
teaserModule.helpers.newItem(),
teaserModule.helpers.newItem()
]
})
}