1

I cant do what is stated here: How to add a custom Markdown function to SimpleMDE? which is:

function drawRedText(editor) {
var cm = editor.codemirror;
var output = '';
var selectedText = cm.getSelection();
var text = selectedText || 'placeholder';

output = '<p class="center">' + text + '</p>'; //.center is defined as {text-align: center;}
cm.replaceSelection(output);
}

As this will not work if I do it on '#h1' which is a heading.

Basically, I am trying to create a function that aligns the selection to the center.

Is there any way to add the styling to the selected/highlighted element?

Community
  • 1
  • 1
Ayudh
  • 1,673
  • 1
  • 22
  • 55

0 Answers0