Module: UI

Methods

(inner) defaultShowPrompt(editor, showPromptopt)

Exposes the core behavior for linking and unlinking text, and allows for customization of the URL input handler.

Parameters:
Name Type Attributes Description
editor Editor

An editor instance to operate on. If a range is selected, either prompt for a URL and add a link or un-link the currently linked text.

showPrompt module:UI~showPrompt <optional>

An optional custom input handler. Defaults to using window.prompt.

Source:
Example
let myPrompt = (message, defaultURL, promptCallback) => {
  let url = window.prompt("Overriding the defaults", "http://placekitten.com");
  promptCallback(url);
};

editor.registerKeyCommand({
  str: "META+K",
  run(editor) {
    toggleLink(editor, myPrompt);
  }
});

Type Definitions

promptCallback(url)

Parameters:
Name Type Description
url String

The URL to pass back to the editor for linking to the selected text.

Source:

showPrompt(message, defaultValue, callback)

Parameters:
Name Type Description
message String

The text of the prompt.

defaultValue String

The initial URL to display in the prompt.

callback module:UI~promptCallback

Once your handler has accepted a URL, it should pass it to callback so that the editor may link the selected text.

Source: