-
Notifications
You must be signed in to change notification settings - Fork 1.3k
HtmlEditor: Add Keyboard Trap Fix Info #9042
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
649db4c
f3dd94a
e7e18a6
27e1e31
6514430
05399b9
1fa2de7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,118 +13,148 @@ Module configurations. | |
| The DevExtreme Quill modules and the API you can use to customize them are described in the <a href="https://github.com/DevExpress/devextreme-quill/tree/master/docs/modules" target="_blank">Modules</a> documentation section. For example, the <a href="https://github.com/DevExpress/devextreme-quill/blob/master/docs/modules/history.md" target="_blank">History</a> module, which handles the undo and redo operations, can be customized as follows: | ||
|
|
||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| $(function() { | ||
| $("#htmlEditorContainer").dxHtmlEditor({ | ||
| // ... | ||
| customizeModules: function(config) { | ||
| config.history = { | ||
| delay: 0, | ||
| maxStack: 5000 | ||
| }; | ||
| } | ||
| }); | ||
| $("#html-editor").dxHtmlEditor({ | ||
| customizeModules(config) { | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| config.history = { | ||
| delay: 0, | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| maxStack: 5000 | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-html-editor ... | ||
| <dx-html-editor | ||
| [customizeModules]="customizeQuillModules"> | ||
| </dx-html-editor> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Component } from '@angular/core'; | ||
| import { DxHtmlEditorModule } from 'devextreme-angular/ui/html-editor'; | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| templateUrl: './app.component.html', | ||
| styleUrls: ['./app.component.css'] | ||
| }) | ||
| // ... | ||
| export class AppComponent { | ||
| customizeQuillModules(config) { | ||
| config.history = { | ||
| delay: 0, | ||
| maxStack: 5000 | ||
| maxStack: 5000, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| <!-- tab: app.module.ts --> | ||
| import { BrowserModule } from '@angular/platform-browser'; | ||
| import { NgModule } from '@angular/core'; | ||
| import { AppComponent } from './app.component'; | ||
|
|
||
| import { DxHtmlEditorModule } from 'devextreme-angular'; | ||
| @NgModule({ | ||
| declarations: [ | ||
| AppComponent | ||
| ], | ||
| imports: [ | ||
| BrowserModule, | ||
| DxHtmlEditorModule | ||
| ], | ||
| providers: [ ], | ||
| bootstrap: [AppComponent] | ||
| }) | ||
| export class AppModule { } | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <DxHtmlEditor ... | ||
| <DxHtmlEditor | ||
| :customize-modules="customizeQuillModules" | ||
| /> | ||
| </template> | ||
|
|
||
| <script> | ||
| import 'devextreme/dist/css/dx.fluent.blue.light.css'; | ||
|
|
||
| import DxHtmlEditor from 'devextreme-vue/html-editor'; | ||
|
|
||
| export default { | ||
| components: { | ||
| DxHtmlEditor | ||
| }, | ||
| methods: { | ||
| customizeQuillModules(config) { | ||
| config.history = { | ||
| delay: 0, | ||
| maxStack: 5000 | ||
| }; | ||
| } | ||
| } | ||
| import { DxHtmlEditor } from 'devextreme-vue/html-editor'; | ||
|
|
||
| function customizeQuillModules(config) { | ||
| config.history = { | ||
| delay: 0, | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| maxStack: 5000, | ||
| }; | ||
| } | ||
| </script> | ||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.js --> | ||
| import React from 'react'; | ||
| <!-- tab: App.tsx --> | ||
| import React, { useCallback } from 'react'; | ||
| import { HtmlEditor } from 'devextreme-react/html-editor'; | ||
|
|
||
| import 'devextreme/dist/css/dx.fluent.blue.light.css'; | ||
| export default function App() { | ||
| const customizeQuillModules = useCallback((config) => { | ||
| config.history = { | ||
| delay: 0, | ||
| maxStack: 5000, | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <HtmlEditor | ||
| customizeModules={customizeQuillModules} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| --- | ||
|
|
||
| import HtmlEditor from 'devextreme-react/html-editor'; | ||
| You can configure **customizeModules** to modify the [keyboard navigation](/Documentation/Guide/UI_Components/HtmlEditor/Accessibility/#Keyboard_Navigation) behavior of HtmlEditor using `keyboard.inlineTabInsertion`: | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
|
||
|
|
||
| class App extends React.Component { | ||
| render() { | ||
| return ( | ||
| <HtmlEditor ... | ||
| customizeModules={this.customizeQuillModules} | ||
| /> | ||
| ); | ||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| $("#html-editor").dxHtmlEditor({ | ||
| customizeModules(config) { | ||
| config.keyboard.inlineTabInsertion = false; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. config.keyboard.inlineTabInsertion = false - it is default HtmlEditor value. If user would change the default value, he would set it to true. |
||
| } | ||
| }); | ||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-html-editor | ||
| [customizeModules]="customizeQuillModules"> | ||
| </dx-html-editor> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Component } from '@angular/core'; | ||
| import { DxHtmlEditorModule } from 'devextreme-angular/ui/html-editor'; | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
|
|
||
| // ... | ||
| export class AppComponent { | ||
| customizeQuillModules(config) { | ||
| config.history = { | ||
| delay: 0, | ||
| maxStack: 5000 | ||
| }; | ||
| config.keyboard.inlineTabInsertion = false; | ||
| } | ||
| } | ||
| export default App; | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <DxHtmlEditor | ||
| :customize-modules="customizeQuillModules" | ||
| /> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { DxHtmlEditor } from 'devextreme-vue/html-editor'; | ||
|
|
||
| function customizeQuillModules(config) { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| } | ||
| </script> | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.tsx --> | ||
| import React, { useCallback } from 'react'; | ||
| import { HtmlEditor } from 'devextreme-react/html-editor'; | ||
|
|
||
| export default function App() { | ||
| const customizeQuillModules = useCallback((config) => { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <HtmlEditor | ||
| customizeModules={customizeQuillModules} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| --- | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ A user can use the following keys to interact with the HTML Editor component: | |
|
|
||
| <table class="dx-table"> | ||
| <tr> | ||
| <th>PC</th> | ||
| <th>Mac</th> | ||
| <th style="min-width: 64px;">PC</th> | ||
| <th style="min-width: 64px;">Mac</th> | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| <th>Action</th> | ||
| </tr> | ||
| <tr> | ||
|
|
@@ -50,25 +50,34 @@ A user can use the following keys to interact with the HTML Editor component: | |
| <td>Insert a line break (in the same paragraph)</td> | ||
| </tr> | ||
| <tr> | ||
| <td colspan="2" rowspan="3">Tab</td> | ||
| <td>Nest current list item (when in a list)</td> | ||
| <td colspan="2">Tab</td> | ||
| <td> | ||
| 1. Indent list items<br> | ||
| 2. Focus the next cell in tables<br> | ||
| 3. Insert a tab character (<code>\t</code>) in text. If <code>keyboard.inlineTabInsertion</code> is disabled, focuses the next focusable element on the page. | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
|
||
| </td> | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| </tr> | ||
| <tr> | ||
| <td>Increase indentation (when at the start of a paragraph)</td> | ||
| <td colspan="2">Shift + Tab</td> | ||
| <td> | ||
| 1. Dedent list items<br> | ||
| 2. Focus the previous cell in tables<br> | ||
| 3. Remove a tab character (<code>\t</code>) from text. If <code>keyboard.inlineTabInsertion</code> is disabled or text contains no tab characters, focuses the previous focusable element in the component. | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
|
||
| </td> | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| </tr> | ||
| <tr> | ||
| <td>Move the cursor to the next table cell</td> | ||
| </tr> | ||
| <tr> | ||
| <td colspan="2" rowspan="2">Shift + Tab</td> | ||
| <td>Move the cursor to the previous table cell</td> | ||
| <td colspan="2">Arrow Keys</td> | ||
| <td>Navigate through the table</td> | ||
| </tr> | ||
| <tr> | ||
| <td>Decrease indentation (when at the start of a paragraph)</td> | ||
| <td>Ctrl + Shift + Up Arrow</td> | ||
| <td>⌘ + Shift + Up Arrow</td> | ||
| <td>Focus the previous focusable element in the component.</td> | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is a Toolbar, the hotkey will focus it. But if there is no Toolbar, the previous focusable element will be focused. |
||
| </tr> | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| <tr> | ||
| <td colspan="2">Arrow Keys</td> | ||
| <td>Navigate through the table</td> | ||
| <td>Ctrl + Shift + Down Arrow</td> | ||
| <td>⌘ + Shift + Down Arrow</td> | ||
| <td>Focus the next focusable element on the page.</td> | ||
| </tr> | ||
| <tr> | ||
| <td colspan="2">Enter</td> | ||
|
|
@@ -84,4 +93,72 @@ A user can use the following keys to interact with the HTML Editor component: | |
| </tr> | ||
| </table> | ||
|
|
||
| Configure [customizeModules](/Documentation/ApiReference/UI_Components/dxHtmlEditor/Configuration/#customizeModules) to toggle `keyboard.inlineTabInsertion`: | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
|
|
||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| $("#html-editor").dxHtmlEditor({ | ||
| customizeModules(config) { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| } | ||
| }); | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-html-editor | ||
| [customizeModules]="customizeQuillModules"> | ||
| </dx-html-editor> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Component } from '@angular/core'; | ||
| import { DxHtmlEditorModule } from 'devextreme-angular/ui/html-editor'; | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
|
|
||
| // ... | ||
| export class AppComponent { | ||
| customizeQuillModules(config) { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| } | ||
| } | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <DxHtmlEditor | ||
| :customize-modules="customizeQuillModules" | ||
| /> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { DxHtmlEditor } from 'devextreme-vue/html-editor'; | ||
|
|
||
| function customizeQuillModules(config) { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| } | ||
| </script> | ||
|
arman-boyakhchyan marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.tsx --> | ||
| import React, { useCallback } from 'react'; | ||
| import { HtmlEditor } from 'devextreme-react/html-editor'; | ||
|
|
||
| export default function App() { | ||
| const customizeQuillModules = useCallback((config) => { | ||
| config.keyboard.inlineTabInsertion = false; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <HtmlEditor | ||
| customizeModules={customizeQuillModules} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| --- | ||
|
|
||
| #include common-code-register-key-handler | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.