EditorJS TextAlign

Need some help here. Created an TextAlign plugin:

Current state is:

<div class="editor block">
Example text
</div>

When button is clicked the button style=“text-align:–” is applied to a div element. Which is all good. But, what i want to achieve is when button is pressed the highlighted text will be wrapped in

<p style="text-align:--">Example text</p>

if this is DOM (dunno, haven’t used editorjs), then Range: surroundContents() method - Web APIs | MDN looks like it would work

:face_with_raised_eyebrow: Im confused.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.