diff --git a/CHANGELOG.md b/CHANGELOG.md index af8372b..df73227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [Unreleased] ### Added +* add editorjs hyperlink block ### Fixed ### Changed diff --git a/src/core/Resources/assets/js/modules/editorjs.js b/src/core/Resources/assets/js/modules/editorjs.js index e366cce..2f5e225 100644 --- a/src/core/Resources/assets/js/modules/editorjs.js +++ b/src/core/Resources/assets/js/modules/editorjs.js @@ -7,6 +7,7 @@ const routes = require('../../../../../../../../../public/js/fos_js_routes.json' const UnderlineInlineTool = InlineTools.UnderlineInlineTool const StrongInlineTool = InlineTools.StrongInlineTool const ItalicInlineTool = InlineTools.ItalicInlineTool +const createGenericInlineTool = require('editorjs-inline-tool/es/tool').default Routing.setRoutingData(routes) @@ -79,7 +80,30 @@ const tools = { }, image: { class: require('../components/editorjs/image-tool.js') - } + }, + bold: { + class: createGenericInlineTool({ + sanitize: { + strong: {}, + }, + shortcut: 'CMD+B', + tagName: 'STRONG', + toolboxIcon: + '', + }), + }, + italic: { + class: createGenericInlineTool({ + sanitize: { + em: {}, + }, + shortcut: 'CMD+I', + tagName: 'EM', + toolboxIcon: + '', + }), + }, + underline: UnderlineInlineTool } const makeId = () => { @@ -95,10 +119,7 @@ const makeId = () => { } const configurationBase = { - tools, - bold: StrongInlineTool, - italic: ItalicInlineTool, - underline: UnderlineInlineTool + tools } const buildConfiguration = (conf) => { @@ -149,6 +170,7 @@ const doInitEditor = () => { const value = JSON.stringify(data) element.val(value) } catch (e) { + element.val('[]') } }) }, 500)