codejar icon indicating copy to clipboard operation
codejar copied to clipboard

Toolbar for markup languages?

Open erickilisboa opened this issue 5 years ago • 3 comments

It would be a boon for users of markdown and textile (even more because it does not depend on a specific syntax highlight) a toolbar for these languages. Or for one of them, but easily modified for others. The options currently available are often quite heavy and cannot be used with external syntax highlighting.

erickilisboa avatar Feb 05 '21 00:02 erickilisboa

I think a such toolbar can be easily implemented. But it out of the scope of the current CodeJar agenda. CodeJar trying to be a language-agnostic editor.

antonmedv avatar Feb 05 '21 08:02 antonmedv

I am trying to create a simple toolbar, however I have a problem. The undo feature does not work for the content inserted by the toolbar.

Is there something wrong with this?

function wrap(tag) {
  jar.recordHistory();

  sel = window.getSelection();
  if (sel.rangeCount) {
    range = sel.getRangeAt(0);
    range.insertNode(document.createTextNode(tag));
    range.collapse();
    range.insertNode(document.createTextNode(tag));
  }

  jar.updateCode(jar.toString());
}

erickilisboa avatar Feb 11 '21 22:02 erickilisboa

Now there is a method: recordHistory.

antonmedv avatar Feb 11 '21 23:02 antonmedv