brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Extensions can't register CodeMirror onKeyEvent handlers #1104

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by davidderaedt Friday Jun 22, 2012 at 11:30 GMT Originally opened as https://github.com/adobe/brackets/issues/1113


Some extensions may need to listen to all CodeMirror onKeyEvent events directly, to override the default behavior currently described in the Editor._installEditorListeners() method.

For instance, this would would allow the creation of extensions which would implement support for zen-coding for CodeMirror2, which is currently only possible by modifying Brackets Editor class itself.

Note: Since the CodeMirror event mapping implementation may become more generic in the future, this could be achieved by exposing this mapping mechanism.

core-ai-bot commented 3 years ago

Comment by sergeche Monday Jun 25, 2012 at 11:20 GMT


The next version of Zen Coding plugin won’t use onKeyEvent listener. I’ve talked with@marijnh about better keybindings implementation, and he said that the better solution is to extend CodeMirror.defaults.extraKeys object with proper keyboard shortcuts.

Although, there might be issues with Tab key (ZC overrides this key to expand abbreviations), but I need more investigation on this.

core-ai-bot commented 3 years ago

Comment by davidderaedt Monday Jun 25, 2012 at 15:56 GMT


Thanks for the heads up !

core-ai-bot commented 3 years ago

Comment by pthiess Thursday Jun 28, 2012 at 00:35 GMT


Hi David,

Thanks a lot for your feedback - Reviewed and removed unrelated story links. This issue is covered by Trello Card #572. I'm closing the issue here. Please remember to vote on the Trello card.

core-ai-bot commented 3 years ago

Comment by pthiess Thursday Jun 28, 2012 at 00:51 GMT


closing

core-ai-bot commented 3 years ago

Comment by sergeche Tuesday Jul 10, 2012 at 21:27 GMT


Just uploaded new Zen Coding for CodeMirror2 plugin: https://github.com/sergeche/zen-coding/blob/v0.7.1/plugins/codemirror2/editor.js

It does’t use onKeyEvent listener anymore, it just extends CodeMirror.defaults.extraKeys object with new actions and uses CM’s internal key handler mechanism.

The integration of ZC plugin is also much simpler now: you just need to include zencoding.js file into your page.

core-ai-bot commented 3 years ago

Comment by davidderaedt Wednesday Jul 11, 2012 at 12:41 GMT


Thanks a lot for the update Serge, it looks like a really nice improvement.

However, brackets does not extend those defaults: it overwrites them when creating a editor instance.

This seems to me like a separate issue, so I'll open a new one.