Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

T/1: Implement Table UI #23

Merged
merged 29 commits into from
Jun 5, 2018
Merged

T/1: Implement Table UI #23

merged 29 commits into from
Jun 5, 2018

Conversation

jodator
Copy link
Contributor

@jodator jodator commented May 29, 2018

Suggested merge commit message (convention)

Feature: Implement the base Table UI.


Additional information

Requires changes in

@jodator jodator requested a review from oleq May 30, 2018 07:30
@oleq
Copy link
Member

oleq commented May 30, 2018

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.

kapture 2018-05-30 at 13 29 45

@oleq
Copy link
Member

oleq commented May 30, 2018

There's somethign wrong with the position of the BalloonToolbar when used for the link in the table because it remains attached to the table, not to the link

screen shot 2018-05-30 at 13 30 07

Not sure which piece of code is broken, TableUI or something else.

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
@jodator
Copy link
Contributor Author

jodator commented May 30, 2018

Why is the table inserted after current block instead of splitting it

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 InsertTableCmmand was implemented. As this is not UI related I'll report this as a follow up and fix it in this iteration.

@jodator
Copy link
Contributor Author

jodator commented May 30, 2018

Not sure which piece of code is broken, TableUI or something else.

After quick checkup with I there might be two issues:

  1. the table feature will show & update position of the balloon but somehow the link plugin contents are inserted so either race condition of which plugin should show baloon on mouse click
  2. when updating selection with keyboard the link plugin updates position of the balloon with data that looks OK ({target: a.ck-link_selected}) but the balloon stays attached to the table.

So I can see that table toolbar could better check when to show it's toolbar.

ps.: I've found some glitch here:
https://github.com/ckeditor/ckeditor5-ui/blob/9b4d88863f2f817a42dd436a3b185a3849ca124a/src/panel/balloon/contextualballoon.js#L196

The position returned here does not match the last one passed to the updatePosition as in the _stack the returned position is for the table and not for the link. But without further investigation I'm not able to see if it is problem of how table uses toolbar or the link.

@oleq
Copy link
Member

oleq commented May 30, 2018

There's a problem with the color of the arrow too

screen shot 2018-05-30 at 14 38 28

@oleq
Copy link
Member

oleq commented May 30, 2018

the table feature will show & update position of the balloon but somehow the link plugin contents are inserted so either race condition of which plugin should show baloon on mouse click

It could boil down to ckeditor/ckeditor5#852 and this is bad :/

@oleq
Copy link
Member

oleq commented May 30, 2018

Table toolbar also hijacks the main balloon editor toolbar, which is a serious issue because it makes the feature incompatible with the BalloonEditor creator.

image

@oleq
Copy link
Member

oleq commented May 30, 2018

BTW where's the drag handler as in https://github.com/ckeditor/ckeditor5-table/issues/1#issuecomment-392034926? Is this also a followup?

@jodator
Copy link
Contributor Author

jodator commented May 30, 2018

BTW where's the drag handler as in #1 (comment)? 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?

@oleq
Copy link
Member

oleq commented May 30, 2018

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).

@oleq
Copy link
Member

oleq commented May 30, 2018

We also need to figure out how to keep the focused cell border on the top

image

Note: position: relative and z-index don't help.

@oleq
Copy link
Member

oleq commented May 30, 2018

@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

@jodator
Copy link
Contributor Author

jodator commented May 30, 2018

@oleq there's also this issue:

selection_057

@jodator
Copy link
Contributor Author

jodator commented May 30, 2018

@oleq The only thing I can see to help this is:

table {
    border-collapse: separate;
}
td {
     border-style: solid;
}

But then the table borders are 2px wide:
selection_059

@dtwist
Copy link
Contributor

dtwist commented May 30, 2018

Use outline instead of border:
https://codepen.io/david-twist/pen/NMQOwO?editors=1000

.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 ],
Copy link
Member

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;
Copy link
Member

@oleq oleq Jun 4, 2018

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
Copy link
Member

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.
Copy link
Member

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 );
Copy link
Member

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.

Copy link
Contributor Author

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.

}

/**
* Single grid box view element.
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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:
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a table

@oleq
Copy link
Member

oleq commented Jun 4, 2018

I also see a warning in the manual test

toolbarview-item-unavailable: The requested toolbar item is unavailable. Read more: https://docs.ckeditor.com/ckeditor5/latest/framework/guides/support/error-codes.html#error-toolbarview-item-unavailable
{name: "splitCell"}

@jodator
Copy link
Contributor Author

jodator commented Jun 4, 2018

@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 ImageToolbar one (hence an table in so many places ;) ).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants