scumbag
October 24, 2024, 12:15am
1
Need some help here. Created an TextAlign plugin:
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TextAlign = factory());
})(this, (function () { 'use strict';
class TextAlign {
static leftAlignedIcon = '<path d="M17 9.5H3M21 4.5H3M21 14.5H3M17 19.5H3"/>'
static centerAlignedIcon = '<path d="M19 9.5H5M21 4.5H3M21 14.5H3M19 19.5H5"/>'
static rightAlignedIcon = '<path d="M21 9.5H7M21 4.5H3M21 14.5H3M21 19.5H7"/>' //'<path d="M17 9.5H3M21 4.5H3M21 14.5H3M17 19.5H3"/>'
static justifyAlignedIcon = '<path d="M21 9.5H3M21 4.5H3M21 14.5H3M21 19.5H3"/>'
This file has been truncated. show original
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>
wh0
October 24, 2024, 6:31pm
2
if this is DOM (dunno, haven’t used editorjs), then Range: surroundContents() method - Web APIs | MDN looks like it would work
system
Closed
April 22, 2025, 10:43pm
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.