Atom's legend can be edited, but only via the modal “Edit atom properties”, which is not very friendly, to say the least...

This can be done by theming legend as

function theme_sdl_editor_legend($variables) {
...
  return "
  <div class='meta' contentEditable='true'>
    <!--copyright={$atom->sid}-->{$atom->rendered->title}, {$by}<!--END copyright={$atom->sid}-->
  </div>
  ";
// instead of
  return "
  <div class='meta'>
    <!--copyright={$atom->sid}-->{$atom->rendered->title}, {$by}<!--END copyright={$atom->sid}-->
  </div>
  ";
}

I also suggest to move the copyright comment out of the div, to make it stay protected;
Also added a link...

  return "
  <!--copyright={$atom->sid}--><div class='meta' contentEditable='true'>
    <a target='_blank' href='atom/{$atom->sid}'>{$atom->rendered->title}</a>, {$by}
  </div><!--END copyright={$atom->sid}-->
  ";

To make it retroactive, just insert in plugin :

    // Prevents atom from being edited inside the editor.
    $(editor.document.$).find('div.dnd-atom-wrapper').attr('contentEditable', false);
+   // Allows atom legend to be edited inside the editor.
+   $(editor.document.$).find('div.dnd-atom-wrapper div.dnd-legend-wrapper div.meta').attr('contentEditable', true);

did not notice any damageable side effects...

Comments

jcisio’s picture

It's a nice idea. In fact it was editable, but contributors trended to modifying the atom, too. Now the wrapper div is not editable, we can make the legend editable.

PS: I was waiting for CKEditor Widget plugin that will hopefully be available in CKEditor 4.3 http://dev.ckeditor.com/ticket/9764

jcisio’s picture

Status: Active » Needs work
StatusFileSize
new1.12 KB

We need at least this. I think we needs to change in editor.on('mode') too. Thus I prefer to refactor it into a "protectAtom" method in the plugin as it is used in 3 places.

jcisio’s picture

Status: Needs work » Needs review
StatusFileSize
new1.84 KB

Like this?

jcisio’s picture

Title: Edit atom's legend in wysiwyg mode » Edit atom legend in wysiwyg mode
StatusFileSize
new1.85 KB

There was a bug in patch #3.

gifad’s picture

Status: Needs review » Needs work

Inspecting closely the wrappers after atom drop, the very first “dnd.protectAtom” does not work (something asynchronous here ?), that's why I thought necessary to patch the dnd_library.module.
If it's not a bug, it should be removed...
In fact, from the user's point of view, that's just a supplementary click (the first one will actually call dnd.protectAtom via dnd.getWrapperElement()).
Also, why did you excude the div.meta and the mee token from the protected area ? Is it for a 100% backward compatibility ?

jcisio’s picture

About the first protectAtom: every time I see "contentEditable: fasle" I replace with protectAtom. I don't remember why I put the first one, maybe it was necessary in the first place, but no longer now (need to check the git log). But that redundant protectAtom should definitely not block this issue.

About the whole dnd-legend-wrapper in the editable area: yes, because it is editable in the dialog. In D6 it was used to store the copyright data, it is still there in D7, but no longer used. We are planning to simplify the wrapper DIVs too. Thus I think just a single DIV for legend wrapper is enough, then free content inside.

gifad’s picture

Status: Needs work » Needs review

Ok, on a fresh install, it works ok (my tests at #5 were on a heavily patched version)
Right after drop, the atom is not protected, but a single click activates the protection (via onclick), and sets the insertion point, in a single operation;
And I can't reproduce typing characters before the div.meta

So, reset issue status ;-)

jcisio’s picture

Status: Needs review » Fixed

This is a minimal patch. I reviewed it again and pushed. Committed yesterday lol bcffbb0.

gifad’s picture

FWIW, the issues I noted in #5 were caused by the “autogrow” ckeditor plugin;
(autogrow 1.2 for ckeditor 4.2)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.