🌱 The next big step: Kirby 4 Alpha Learn more
Skip to content

Custom textarea buttons

panel.plugin("getkirby/custom-textarea-buttons", {
  textareaButtons: {
    marquee: {
      label: "Marquee",
      icon: "wand",
      command(input, selection) {
        this.command("insert", (input, selection) => {
          if (["<marquee>", "</marquee>"].some(tag => selection.includes(tag))) {
            return selection.replace(/\<marquee\>|\<\/marquee\>/g, '');
          }

          return "<marquee>" + selection + "</marquee>";
        });
      },
      shortcut: "m"
    }
  },
});