How to use the medium-editor.Extension function in medium-editor

To help you get started, we’ve selected a few medium-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bananaoomarang / chapters / shared / lib / cheeky-keys.js View on Github external
node.textContent = removeChar(node.textContent, position - 1);

    const caret = getCaret(node);
    caret.setPosition(position - 2);
   }
   else {
     node.innerHTML = insertString(node.innerHTML, htmlPosition, '.');
     node.textContent = removeChar(node.textContent, position);

     const caret = getCaret(node);
     caret.setPosition(position)
     //MediumEditor.selection.moveCursor(document, node, position)
   }
}

export default MediumEditor.Extension.extend({
  name: 'cheeky-keys', // Safe to say we're in our own namespace here.

  triggers: [
    {
      key:     '"',
      handler: handleDoubleQuote,
    },

    {
      key:     "'",
      handler: handleSingleQuote,
    },

    {
      key:     '.',
      handler: handleElipsis,
github getlackey / lackey-cms / modules / cms / client / js / wysiwyg.js View on Github external
if (self.isProperty) {
            options.toolbar = false;
        }

        if (options.toolbar && Array.isArray(options.toolbar.buttons)) {
            options.toolbar.buttons.forEach((button, i) => {
                if (typeof (button) !== 'string') { return; }

                if (buttonDefinitions[button]) {
                    options.toolbar.buttons[i] = buttonDefinitions[button];
                }
            });
        }

        var InsertMedia = MediumEditor.Extension.extend({
            name: 'insert-media',
            getButton: function (editor, getter) {
                var btn = document.createElement('button');
                btn.innerText = 'Media';
                btn.addEventListener('click', event => {
                    event.preventDefault();
                    event.stopPropagation();

                    top.LackeyManager
                        .stack
                        .inspectMedia({}, null)

                    .then(result => {

                        if (result) {
                            let
github bananaoomarang / chapters / shared / lib / cheeky-keys.js View on Github external
init: function () {
    MediumEditor.Extension.prototype.init.apply(this, arguments);

    this.subscribe('editableInput', this.handleInput.bind(this));

    this.keys = {};

    this.triggers
      .forEach((key, i) => {
        this.keys[key.keyCode] = i;
      });
  },