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

XWIKI-21782: Incentivize use of header rows for the WYSIWYG editor tables #3310

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(function() {
'use strict';
CKEDITOR.plugins.add('xwiki-table', {
requires: 'table',
requires: 'table, xwiki-localization',
init: function(editor) {
// The table plugin is using the deprecated align attribute for various reasons. See
// https://dev.ckeditor.com/ticket/3762 . We could overwrite the table dialog to use the margin:auto style but it
Expand Down Expand Up @@ -69,6 +69,16 @@
['txtBorder', 'txtWidth', 'txtCellSpace', 'txtCellPad'].forEach(function(fieldId) {
delete infoTab.get(fieldId)['default'];
});
// Set a new default for the Headers value
infoTab.get( 'selHeaders' )[ 'default' ] = 'row';
// Create a warning message for the accessibility without headers
// We navigate the structure of the macro to insert this message exactly next to the header.
infoTab.elements[0].children[0].children.splice(4, 0, {
type : 'html',
html : '<span class="box warningmessage">' +
editor.localization.get('xwiki-table.header.accessibilitywarning') +
'</span>'
});
};

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void table()
// Write some text
textArea.sendKeys(TEST_TEXT);

assertSourceEquals("|" + TEST_TEXT + "| \n| | \n| | \n\n ");
assertSourceEquals("|=" + TEST_TEXT + "|= \n| | \n| | \n\n ");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,20 @@ td.cke_dialog_contents_body {
overflow-y: auto;
}

/**
* Handle the layout and display of the warning message for headerless tables.
* Some of the default styles are just overridden by the CKEditor reset.
*/
.cke_dialog_container span.box.warningmessage {
.alert-warning;
white-space: break-spaces;
display: none;
}

.cke_dialog_container tr:has(select [value=""]:checked) + tr span.box.warningmessage {
display: unset;
}

/**
* Link Options Toggle
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ ckeditor.plugin.save.leaveConfirmationMessage=There are unsaved changes. Do you
ckeditor.plugin.save.failed=The content cannot be saved because of a CKEditor internal error. You should try to copy your important changes and reload the editor.
ckeditor.plugin.source.conversionFailed=Failed to perform the conversion.

ckeditor.plugin.table.header.accessibilitywarning=Using headers will make your table easier to understand.

ckeditor.plugin.toolbar.basicStyles=Basic Styles
ckeditor.plugin.toolbar.lists=Lists
ckeditor.plugin.toolbar.bulletedlist=Bulleted List
Expand Down