import { AnchorModifications } from "./AnchorModifications.js";
import { anchorElementPlugin } from "./AnchorElement.js";
import { anchorHtmlDeserializer } from "./AnchorHtmlDeserializer.js";
import { parseUrl } from "../../../utils/parseUrl.js";
const withAnchors = (editor) => {
  const { insertText } = editor;
  editor.registerElement(anchorElementPlugin);
  editor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer);
  editor.insertText = (text) => {
    if (text && parseUrl(text) !== void 0) {
      AnchorModifications.wrapAnchor(editor, text);
    } else {
      insertText(text);
    }
  };
  return editor;
};
export {
  withAnchors
};
//# sourceMappingURL=withAnchors.js.map
