image icon indicating copy to clipboard operation
image copied to clipboard

Disable Settings (caption, withBorder, withBackground, stretched)

Open SebastianVomMeer opened this issue 6 years ago • 5 comments

I am new to Editor.js and not sure if this is plugin-specific or not. Is it possible to disable specific settings (caption, withBorder, withBackground, stretched) or disable settings at all? I don't need a background variant, so the user shouldn't be able to choose it in the first place.

Thank you very much, I appreciate your work!

SebastianVomMeer avatar May 09 '19 11:05 SebastianVomMeer

Accroding to No ability to provide available levels #14, I tried to extend ImageTool and just render default zone.

const ImageTool = require('@editorjs/image');

class MyImageTool extends ImageTool {
  renderSettings() {
    const div = document.createElement('div');
    div.style.marginTop = '-6px';
    return div;
  }
}

const editor = new EditorJS({
  holder: 'codex-editor',
  autofocus: true,
  tools: {
    image: {
      class: MyImageTool,
    }
  }
});

But in Caption case, I am not sure about the best solution. Currently I just make .image-tool__caption { display: none; }.

lininu avatar Jul 01 '19 02:07 lininu

.cdx-settings-button[data-tune='withBorder'],
.cdx-settings-button[data-tune='withBackground'],
.cdx-settings-button[data-tune='stretched'] {
  display: none;
}

easy method

ovo4096 avatar Sep 13 '19 03:09 ovo4096

I've created a pull request with the option to configure which default elements you want to disable. Check it out here.

Duncank avatar Jul 27 '20 11:07 Duncank