Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["url"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
// attributes: ["href"],
// decorator: ImageEntity,
// icon: ,
// source: ImageSource,
// type: ENTITY_TYPE.IMAGE
// }
]}
/>
{helperText && (
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["href"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
// attributes: ["href"],
// decorator: ImageEntity,
// icon: ,
// source: ImageSource,
// type: ENTITY_TYPE.IMAGE
// }
]}
/>
{helperText && (
onClick={() => onRemove(entityKey)}>Remove
}>
<a role="button" rel="noopener noreferrer">
<span>{props.children}</span>
</a>
);
}
// Entity
const LINK = {
type: ENTITY_TYPE.LINK,
icon: ,
source: LinkSource,
decorator: LinkDecorator,
attributes: ['href', 'internal']
};
export default LINK;
const clone = {};
fieldsToSave.forEach((field) => {
clone[field] = data[field];
});
itemData = clone;
} else {
// Use the whole object.
itemData = data;
}
const nextData = Object.assign({}, itemData, {
id,
label,
});
const nextState = DraftUtils.createEntity(
editorState,
type,
nextData,
nextData.label,
entityMutability,
);
onUpdate(nextState);
}
export const getChooserConfig = (entityType, entity) => {
const chooserURL = {};
chooserURL[ENTITY_TYPE.IMAGE] = `${global.chooserUrls.imageChooser}?select_format=true`;
chooserURL[EMBED] = global.chooserUrls.embedsChooser;
chooserURL[ENTITY_TYPE.LINK] = global.chooserUrls.pageChooser;
chooserURL[DOCUMENT] = global.chooserUrls.documentChooser;
let url = chooserURL[entityType.type];
let urlParams = {};
if (entityType.type === ENTITY_TYPE.LINK) {
urlParams = {
page_type: 'wagtailcore.page',
allow_external_link: true,
allow_email_link: true,
can_choose_root: 'false',
// This does not initialise the modal with the currently selected text.
// This will need to be implemented in the future.
// See https://github.com/jpuri/draftjs-utils/blob/e81c0ae19c3b0fdef7e0c1b70d924398956be126/js/block.js#L106.
<small><em>format:</em> {formatLabel}</small>
<div>
<small style="{{textDecoration:"> blockProps.onEditEntity(blockProps.entityKey)}>
edit
</small>
</div>
);
}
// Entity
const IMAGE = {
type: ENTITY_TYPE.IMAGE,
icon: ,
source: ImageSource,
block: ImageBlock,
attributes: [
'credits',
'format',
'height',
'width',
'src'
]
};
export default IMAGE;
{ icon: , type: BLOCK_TYPE.HEADER_THREE },
{ icon: , type: BLOCK_TYPE.BLOCKQUOTE },
{
icon: ,
type: BLOCK_TYPE.UNORDERED_LIST_ITEM
},
{ icon: , type: BLOCK_TYPE.ORDERED_LIST_ITEM }
]}
inlineStyles={[
{
icon: ,
type: INLINE_STYLE.BOLD
},
{
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["url"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
{ icon: , type: BLOCK_TYPE.HEADER_THREE },
{ icon: , type: BLOCK_TYPE.BLOCKQUOTE },
{
icon: ,
type: BLOCK_TYPE.UNORDERED_LIST_ITEM
},
{ icon: , type: BLOCK_TYPE.ORDERED_LIST_ITEM }
]}
inlineStyles={[
{
icon: ,
type: INLINE_STYLE.BOLD
},
{
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["href"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
type: BLOCK_TYPE.UNORDERED_LIST_ITEM
},
{ icon: , type: BLOCK_TYPE.ORDERED_LIST_ITEM }
]}
inlineStyles={[
{
icon: ,
type: INLINE_STYLE.BOLD
},
{
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["href"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
// attributes: ["href"],
// decorator: ImageEntity,
// icon: ,
// source: ImageSource,
type: BLOCK_TYPE.UNORDERED_LIST_ITEM
},
{ icon: , type: BLOCK_TYPE.ORDERED_LIST_ITEM }
]}
inlineStyles={[
{
icon: ,
type: INLINE_STYLE.BOLD
},
{
icon: ,
type: INLINE_STYLE.ITALIC
},
{
icon: ,
type: INLINE_STYLE.STRIKETHROUGH
}
]}
enableLineBreak
entityTypes={[
{
attributes: ["url"],
decorator: LinkEntity,
icon: ,
source: LinkSource,
type: ENTITY_TYPE.LINK
}
// {
// attributes: ["href"],
// decorator: ImageEntity,
// icon: ,
// source: ImageSource,