From d9fa00a06a37443efdf73aa0ff3f932aba3d203d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD?= Date: Wed, 22 May 2024 17:43:53 +0500 Subject: [PATCH] feat: add inline tools --- src/Sitko.EditorJS.Blazor/wwwroot/strikethrough.js | 1 + src/Sitko.EditorJS/Blocks/Marker/MarkerBlock.cs | 10 ++++++++++ .../Blocks/Strikethrough/StrikethroughBlock.cs | 10 ++++++++++ src/Sitko.EditorJS/Blocks/Underline/UnderlineTool.cs | 10 ++++++++++ 4 files changed, 31 insertions(+) create mode 100644 src/Sitko.EditorJS.Blazor/wwwroot/strikethrough.js create mode 100644 src/Sitko.EditorJS/Blocks/Marker/MarkerBlock.cs create mode 100644 src/Sitko.EditorJS/Blocks/Strikethrough/StrikethroughBlock.cs create mode 100644 src/Sitko.EditorJS/Blocks/Underline/UnderlineTool.cs diff --git a/src/Sitko.EditorJS.Blazor/wwwroot/strikethrough.js b/src/Sitko.EditorJS.Blazor/wwwroot/strikethrough.js new file mode 100644 index 0000000..408b681 --- /dev/null +++ b/src/Sitko.EditorJS.Blazor/wwwroot/strikethrough.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Strikethrough=t():e.Strikethrough=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=4)}([function(e,t,n){var r=n(1),o=n(2);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};r(o,i);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function u(e){for(var t=-1,n=0;n'}}],[{key:"isInline",get:function(){return!0}},{key:"sanitize",get:function(){return{s:{class:e.CSS}}}}]),e}()}]).default})); diff --git a/src/Sitko.EditorJS/Blocks/Marker/MarkerBlock.cs b/src/Sitko.EditorJS/Blocks/Marker/MarkerBlock.cs new file mode 100644 index 0000000..035dda3 --- /dev/null +++ b/src/Sitko.EditorJS/Blocks/Marker/MarkerBlock.cs @@ -0,0 +1,10 @@ +namespace Sitko.EditorJS.Blocks.Marker; + +[ContentBlock("Marker")] +public record MarkerBlock : ContentBlock; + +public record MarkerBlockOptions : ContentBlockOptions +{ + public override string ScriptUrl { get; set; } = "https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"; + public override string ClassName { get; set; } = "Marker"; +} diff --git a/src/Sitko.EditorJS/Blocks/Strikethrough/StrikethroughBlock.cs b/src/Sitko.EditorJS/Blocks/Strikethrough/StrikethroughBlock.cs new file mode 100644 index 0000000..e7c3b75 --- /dev/null +++ b/src/Sitko.EditorJS/Blocks/Strikethrough/StrikethroughBlock.cs @@ -0,0 +1,10 @@ +namespace Sitko.EditorJS.Blocks.Strikethrough; + +[ContentBlock("Strikethrough")] +public record StrikethroughBlock : ContentBlock; + +public record StrikethroughBlockOptions : ContentBlockOptions +{ + public override string ScriptUrl { get; set; } = "/_content/Sitko.EditorJS.Blazor/strikethrough.js"; + public override string ClassName { get; set; } = "Strikethrough"; +} diff --git a/src/Sitko.EditorJS/Blocks/Underline/UnderlineTool.cs b/src/Sitko.EditorJS/Blocks/Underline/UnderlineTool.cs new file mode 100644 index 0000000..13792e8 --- /dev/null +++ b/src/Sitko.EditorJS/Blocks/Underline/UnderlineTool.cs @@ -0,0 +1,10 @@ +namespace Sitko.EditorJS.Blocks.Underline; + +[ContentBlock("Underline")] +public record UnderlineTool : ContentBlock; + +public record UnderlineBlockOptions : ContentBlockOptions +{ + public override string ScriptUrl { get; set; } = "https://cdn.jsdelivr.net/npm/@editorjs/underline@latest"; + public override string ClassName { get; set; } = "Underline"; +}