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

Port Table edit plugin #2358

Merged
merged 90 commits into from
Feb 29, 2024
Merged

Conversation

Andres-CT98
Copy link
Contributor

@Andres-CT98 Andres-CT98 commented Jan 24, 2024

Plugin needs

Function Need from DOM Cursor position Is Drag and Drop?
Mover (Selector) Table position on Document Always outside table No
Resizer Table position on Document Always outside table Yes
Inserter Table and cell position on Document Always outside table No
Cell resizer Table and cell position on Document Always inside table Yes

Progress

  • Copy plugin to Content model
  • Change IEditor to IStandaloneEditor in plugin and make necessary adaptations
    • TableResize renamed to TableEditPlugin
    • TableSelector renamed to TableMover
  • Make plugin usable on Demo site
    • Old plugin is removed from demo
  • Change functions to use already existing Content model ones where applicable
    • Table Mover and Table Inserter now use CM fully on their functionality
    • The handles of the all plugins still only use js and css
    • Table resizer and Cell resizer use CM on its functionality of resizing and use js for writeback
  • Bring to Standalone Editor needed functions
  • Remove all uses of non Content model dependencies
    • No plugin has dependencies outside content model packages
    • onShowHelperElement method removed
    • Functionality to resize all columns equally while pressing shift removed, as it was non functioning and unused.
    • Normalization of cells occurs only in normalizeTable
    • A check for Min Width was used in CellResizer when resizing columns due to the possibility of normalisation causing a wrong writeback
  • Add test cases
    • Port and rework of unit tests for Table edit plugin. Scenarios tested:
      • Table Edit Plugin:
        • Dismiss table editor on mouse out
        • Do not dismiss table editor on mouse out, related target is contained in scroll container
        • Do not dismiss table editor on mouse out, table editor not
        • Do not dismiss table editor on mouse out, related target null
        • Do not dismiss table editor on mouse out, currentTarget null
      • Table Mover
        • Display component on mouse move inside table
        • Display component, Top of table is visible in the scroll container scrolled down
        • Do not display component, top of table is no visible in the container
        • Do not display component, Top of table is no visible in the scroll container
        • On Click
      • Cell Resizer
        • Increase the height of the first row of a standard table
        • Decrease the height of the first row of a standard table
        • Increase the height of the last row of a standard table
        • Decrease the height of the last row of a standard table
        • Increase the width of the first column of a standard table
        • Decrease the width of the first column of a standard table
        • Increase the width of the last column of a standard table
        • Decrease the width of the last column of a standard table
      • Table Resizer
        • Removes table resizer on input
        • Removes table resizer on content change
        • Removes table resizer on scrolling
        • Increases the width of a standard table
        • Increases the height of a standard table
        • Increases the width and height of a standard table
        • Decreases the width of a standard table
        • Decreases the height of a standard table
        • Decreases the width and height of a standard table
      • Table Inserter
        • Adds a new column if the vertical inserter is detected and clicked
        • Adds a new row if the horizontal inserter is detected and clicked
        • Does not add inserter if top left corner hovered
        • Does not add new column if top middle clicked on merged top row
        • Does not add new row if left middle clicked on merged first column

Warnings and implications

  • An issue was found when changing zoom: The CSS of the table not reflecting the values of that table in Content Model Table widths.

Copy link
Contributor

@juliaroldi juliaroldi left a comment

Choose a reason for hiding this comment

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

Should we have the test cases in this PR to ensure this plugin behaves as expected?

@Andres-CT98
Copy link
Contributor Author

Should we have the test cases in this PR to ensure this plugin behaves as expected?

I prefer it be done in a separate one to keep the focus of this PR on the code of the implementation.

@juliaroldi
Copy link
Contributor

juliaroldi commented Feb 21, 2024

Should we have the test cases in this PR to ensure this plugin behaves as expected?

I prefer it be done in a separate one to keep the focus of this PR on the code of the implementation.

I'm worried that if someone makes a change that could potentially break this feature, it might go unnoticed until the feature breaks, because we do not have unit test. But if you already have a PR for unit test ready, I think it is ok the way it is.

@JiuqingSong
Copy link
Contributor

JiuqingSong commented Feb 29, 2024

The dev code change looks good to me now.

@Andres-CT98 Andres-CT98 merged commit c950e5b into master Feb 29, 2024
7 checks passed
@Andres-CT98 Andres-CT98 deleted the u/acampostams/port-table-edit-plugin branch February 29, 2024 18:43
ianeli1 added a commit that referenced this pull request Mar 1, 2024
* fix collapsed

* remove test

* fix list

* remove margins

* Workaround for no mouseUp event (#2423)

* Rename StandaloneEditor to Editor (#2416)

* Rename StandaloneEditor to Editor

* fix build

* add parameter

* fix conflicts

* fix selection

* Fix insertNode: Do not reselect if updateCursor is false (#2431)

* Bump ip from 1.1.5 to 1.1.9 (#2433)

Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9.
- [Commits](indutny/node-ip@v1.1.5...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Outdent indented empty paragraph when pressing Backspace. (#2429)

* outdent on backspace

* Remove unneeded check

* fix test build

* handle Tab key for paragraph

* fix build

* fix build

* remove /lib

* disable list features

* save last focus

* Support adding options for exportContent (#2443)

* Set RootFontSize to SanitizingContext (#2445)

* init

* fix Build

* Check once if it is Rem Unit

* refactor

* fix build

* Fix #2435 (#2442)

* format with content model

* remove empty line

* Split contentDiv into physicalRoot and logicalRoot (#2441)

* Split contentDiv into physicalRoot and logicalRoot

* Fix failing test

* Fixed failing test harnesses

* Updated in response to PR comments

* Fix tests

* add unit test

* Fix dispose plugin issus in EditorAdapter (#2452)

* Fix #2202 again (#2450)

* Improve Entity State related API (#2444)

* Improve Entity State related API

* fix build and test

* add test

---------

Co-authored-by: Bryan Valverde U <[email protected]>

* Port Table edit plugin (#2358)

* Standalone Editor step 2

* Standalone Editor step 3

* improve

* Standalone Editor step 4

* Standalone Editor: Remove compatible enums from standalone editor

* improve

* Standalone Editor: Create new event types

* Port to new event system

* Revert "Port to new event system"

This reverts commit 60cf041.

* Port to new event system

* Improve

* fix build

* fix demo

* Fix buttons

* fix build

* fix build

* fix build

* plugin added to cm demo site

* pluginUtils imported

* IStandaloneEditor changes

* editTable can skip undo snapshot

* TableEditPlugin port start

* move D&D to folder

* add plugin to Standalone demo and remove old plugin

* demo fix

* rename D&D and fix import

* demo site changes

* rename selector to mover

* new plugin utils, organisation

* isMobileOrTablet

* cleanup

* normalise width too

* remove onShowHelperElement, fix containment, instancing, others

* implement cell resizer

* fix type import

* fix selection

* fix imports

* fix instanceof, use formatTableWithContentModel, getDOMHelper

* fix merge

* small fix

* fix table resize functionality

* fix merge

* fix import

* fix dependency

* fix exports

* merge fix

* export MIN_WIDTH

* fix resizers

* add check

* fix color

* fix instanceof

* change IStandaloneEditor to IEditor

* fix export const

* rename const

* fix cell resizer, add ids

* add tests

* fix build issues

---------

Co-authored-by: Jiuqing Song <[email protected]>

* Port ShortcutPlugin (#2427)

* Port ShortcutPlugin

* fix build

* add test

* add test

* add test

* fix build

* fix build

* improve

* fix comment

* fix test

* Add option to configure the default paste type (#2457)

* init

* Add tests

* Fix build

* Bump Versions

* Remove Space

* Fix 258837 and 257626 (#2459)

* Remove Bg Color from block on Merge Paste (#2458)

* init

* Remove unneeded code

* address comment

* remove empty line

* Fix Version Numbers

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Júlia Roldi <[email protected]>
Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Jiuqing Song <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bryan Valverde U <[email protected]>
Co-authored-by: florian-msft <[email protected]>
Co-authored-by: Andres-CT98 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants