如何获取ckEditor内联模式当前可编辑选择的id属性值?

how to get the value of id attribute of current editable selection of ckEeditor inline mode?

我是第一次尝试实现 ckeditor 的内联编辑,我已经阅读了文档和解决方案,但我还没有找到解决我的问题的方法。

我正在修改的 div 标签的内容没有唯一的 id,实际上它是在运行时生成的,就像这样

<%
    for(Section subSection:subSections) {
%>
    <div class="editable" id="contact<%=subSection.getSectionId()%>" contenteditable="true">
             <content goes here that also comes from db>
    </div> 
<%}%>

我可以像这样点击保存按钮来显示当前选择的内容

CKEDITOR.plugins.registered['save'] = {
    init: function (editor) {
        var command = editor.addCommand('save',
        {
            modes: { wysiwyg: 1, source: 1 },
            exec: function (editor) { // Add here custom function for the save button

                console.log(editor.getData());

            }
        });
        editor.ui.addButton('Save', { label: 'Save', command: 'save' });
    }
}

但我还需要当前选择的 div 的 Id 属性值,我不确定如何获取。 我能够在 tinymce 中用 var div_id = tinymce.activeEditor.id; 做到这一点,如果有帮助的话。

editor.element.getId()。在命令的 exec 方法中使用它。详细了解 CKEDITOR.editor#element