【发布时间】:2017-02-10 16:55:44
【问题描述】:
我目前在一个可以编辑文章的项目中使用Medium Editor JS Clone。
编辑器工作得很好,我可以格式化元素并且代码很干净,但我现在正在尝试找到一种在编辑时添加照片的方法。
一个很好的解决方案是在绝对模式下为活动段落添加一个侧边按钮,但我还没有找到任何方法来为当前活动段落添加一个类。
这是它生成的:
<div class="editable" contenteditable="true" spellcheck="true" data-medium-editor-element="true" role="textbox" aria-multiline="true" data-medium-editor-editor-index="1" medium-editor-index="574f8260-cdfd-bf53-e5e4-3fff9da2aa19" data-placeholder="Scrivi il testo..." data-medium-focused="true">
<p>Hello this is an editor test.</p>
<p>This is an another paragraph.</p>
</div>
这是我想要的:
因此,知道编辑器 div 中的哪个 p 是当前活动的,我可以设置侧边按钮的顶部位置,然后单击将刚刚上传的照片附加到段落中。
【问题讨论】:
-
你的代码现在可以工作了吗?
标签: javascript jquery medium-editor