-
Notifications
You must be signed in to change notification settings - Fork 18
T/1: Implement Table UI #23
Conversation
…table-merge-cell, and table-headers.
…d and SetHeaderRowCommand.
Why is the table inserted after current block instead of splitting it (see v4 https://ckeditor.com/ckeditor-4/)? It's not very intuitive IMO. |
Includes: - Row, Col, Cell icons from https://github.com/ckeditor/ckeditor5-table/issues/1 - Alternate Table icon with 3 x 3 grid to match the row/col/cell icons above - Merge/Unmerge toggle states in case they are wanted instead of cell drop-down once multi-cell selection is working
That's why we need this Table UI fast :D Things as this will come as one can actually test tables with UI better. It's the way how |
After quick checkup with I there might be two issues:
So I can see that table toolbar could better check when to show it's toolbar. ps.: I've found some glitch here: The position returned here does not match the last one passed to the updatePosition as in the |
It could boil down to ckeditor/ckeditor5#852 and this is bad :/ |
BTW where's the drag handler as in https://github.com/ckeditor/ckeditor5-table/issues/1#issuecomment-392034926? Is this also a followup? |
Hmm. Good question. I might assumed this as a widget feature (so also for an image) and as such could have follow-up. If not R- this PR and I'll add this. WDYT? |
OK, I created an issue in ckeditor5-widget. By default (until we implement the propoer drag and drop), only the table widget is supposed to have this selection (later: drag) handler. So it must be explicitely enabled by a widget (e.g. as a property). |
@dkonopka Can you check that out #23 (comment)? It looks like a general issue – in the image toolbar too. Also a regression as I recall we've already fixed that twice or so :P |
@oleq there's also this issue: |
@oleq The only thing I can see to help this is: table {
border-collapse: separate;
}
td {
border-style: solid;
} |
Use outline instead of border: .highlight {
outline: 3px solid rgb(71, 164, 245);
outline-offset: -1px; /* progressive enhancement - no IE support */
box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .2);
} |
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
plugins: [ ArticlePluginSet, Table ], | ||
plugins: [ ArticlePluginSet, Table, TableToolbar ], |
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.
The manual test should get a description/scenario since now we have a UI. ATM it is empty.
|
||
const { column } = tableUtils.getCellLocation( tableCell ); | ||
|
||
const columnsToSet = column + 1 !== currentHeadingColumns ? column + 1 : column; |
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.
Please ify it
let { column } = tableUtils.getCellLocation( tableCell );
if ( column !== currentHeadingColumns - 1 ) {
column ++;
}
} | ||
|
||
/** | ||
* @inheritDoc |
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.
I'm pretty sure it does more than that. It must be explained (see: linkcommand.js
)
} | ||
|
||
/** | ||
* Checks if table cell is in heading section. |
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.
a table cell
in the heading section
|
||
this.isEnabled = !!tableParent; | ||
|
||
this.value = this.isEnabled && this._isInHeading( position.parent, tableParent ); |
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.
Why is the value dependent on isEnabled
? https://docs.ckeditor.com/ckeditor5/latest/api/module_core_command-Command.html#member-value does not mention that and I couldn't find another command which acts like that.
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.
I'll update this piece of code as it does not make sense to check if selection is in heading when there is no table.
src/ui/inserttableview.js
Outdated
} | ||
|
||
/** | ||
* Single grid box view element. |
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.
"A single". A reference to the class using the box would also be nice ;-)
src/ui/utils.js
Outdated
} | ||
|
||
/** | ||
* Returns the positioning options that control the geometry of the |
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.
that controls
src/utils.js
Outdated
} | ||
|
||
/** | ||
* Checks if a given view element is an table widget. |
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.
a table
src/utils.js
Outdated
const tableSymbol = Symbol( 'isImage' ); | ||
|
||
/** | ||
* Converts a given {@link module:engine/view/element~Element} to an table widget: |
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.
a table
src/utils.js
Outdated
} | ||
|
||
/** | ||
* Checks if an table widget is the only selected element. |
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.
a table
I also see a warning in the manual test
|
@oleq All the issues were fixed - the only one that I didn't touch is this one as I wrote there I've wrote this docs basically the same way as |
Suggested merge commit message (convention)
Feature: Implement the base Table UI.
Additional information
Requires changes in
isEnabled
state changes. ckeditor5-ui#390