Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable inline table editing and resizing controls in Firefox #432

Closed
kiejo opened this issue Aug 16, 2016 · 3 comments
Closed

Disable inline table editing and resizing controls in Firefox #432

kiejo opened this issue Aug 16, 2016 · 3 comments

Comments

@kiejo
Copy link
Contributor

kiejo commented Aug 16, 2016

Firefox provides additional UI controls to edit tables when they are contenteditable, which looks like this:
table_controls_ff

Using these controls does not play well with ProseMirror (e.g. inserting a row does not insert a row in the document model, resizing the table does not do anything).

It is possible to disable these controls with this code:

document.execCommand('enableObjectResizing', false, 'false');
document.execCommand('enableInlineTableEditing', false, 'false');

More information: https://developer.mozilla.org/en/docs/Web/API/Document/execCommand

I am currently calling these methods inside my code outside of ProseMirror. We could also think about directly putting these function calls in the ProseMirror code.

@marijnh
Copy link
Member

marijnh commented Aug 16, 2016

The stupid thing (and I really wonder what the people who came up with execCommand in general were thinking) is that this appears to be a global, per window setting, with no way to apply it only to our editable element. So I can see this interacting badly with other elements in the page, and I'd feel somewhat bad about just adding these lines to our library init code.

A quick search doesn't however, find any saner alternatives. Do you happen to know of any?

@kiejo
Copy link
Contributor Author

kiejo commented Aug 16, 2016

Unfortunately I did not find any alternatives and I agree that putting these lines in our library code is less than ideal. Maybe this is something we should put somewhere in the documentation? As soon as you know about this issue, it is rather easy to decide if one wants to use execCommand to work around it or not.

@marijnh
Copy link
Member

marijnh commented Sep 21, 2016

Noted in the docs in ProseMirror/prosemirror-schema-table@57c170f

@marijnh marijnh closed this as completed Sep 21, 2016
micgro42 added a commit to cosmocode/prosemirror-tables that referenced this issue Aug 28, 2018
This is essentially the same commit as
ProseMirror/prosemirror-schema-table@57c170f
by @marijnh

The rationale behind this is discussed in ProseMirror/prosemirror#432

This closes ProseMirror#22
micgro42 added a commit to cosmocode/dokuwiki-plugin-prosemirror that referenced this issue Aug 29, 2018
Firefox adds its own controls to tables that are content editable, but
they are useless with Prosemirror. Thus we are disabling them.

Note that this is disabling them globally for the whole window.

See ProseMirror/prosemirror#432 and ProseMirror/prosemirror-tables#22

WIKI-198. #53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants