embed icon indicating copy to clipboard operation
embed copied to clipboard

Disable caption

Open literakl opened this issue 4 years ago • 3 comments

Nice plugin. Is there a way how to disable a caption? I do not want it in my editor. Thank you

image

literakl avatar Aug 24 '20 17:08 literakl

You can do the following with css:

    .embed-tool__caption {
        display: none;
    }

JVisuri1 avatar Sep 22 '21 06:09 JVisuri1

Hey @literakl, I don't know if you have already done that but we wanted to control if the caption should appear on read-only mode if it is empty and I found a solution that may be interesting for you. I extended the Embed class and removed the caption html element after calling the render method:

import Embed from '@editorjs/embed';

export default class CustomEditorJSEmbed extends Embed {
  render() {
    this.element = Embed.prototype.render.call(this);

    if (this.readOnly && !this.data.caption) {
      this.element.removeChild(this.element.lastChild);
    }

    return this.element;
  }
}

AlysonBasilio avatar Jun 01 '22 12:06 AlysonBasilio

Thanks, but I have switched away from editorjs.

literakl avatar Jun 05 '22 10:06 literakl