w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

July 29th F2F Agenda Item - Opt-in/opt-out of editing features and menus #35

Closed chong-z closed 7 years ago

chong-z commented 7 years ago

Original issue https://github.com/w3c/editing/issues/141, https://github.com/w3c/editing/issues/93

In summary, we want to be able to specify 2 lists of allowed/disallowed editing features for

  1. Individual editing hosts, and
  2. Preferably avoid polluting the HTMLElement interface
    • Maybe a new HTMLElement subclass? Not sure it will work for cE

@johanneswilm has proposed a solution https://github.com/w3c/editing/issues/93#issuecomment-225386782

We can then have both opt in and out and a keyword "all" that enables or disables everything. Something like:

let el = document.getElementById('editor')
let editor = el.getEditor()

editor.disableCommands(['all']) // disables everything
editor.enableCommands(['copy','paste','cut','bold','underline']) // reenables the given array of commands
editor.checkCommands(['enlarge']) // True if the browser's UI supports a command with the name "enlarge"
chong-z commented 7 years ago

Oh actually this shouldn't be moved to w3c/input-events, closing.