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

Move Paste from publicApi to coreApi to leverage the same domToModelOptions #2275

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

BryanValverdeU
Copy link
Contributor

The problem:
Paste Code is not respecting the domToModelOptions that are passed in when instantiating the editor.

Change:
Move the paste code from publicApi to coreApi to be able to access the defaultDomToModelOptions that are stored in the StandaloneCoreEditor Object.

domToModelOption: Object.assign(
{},
...[
core.defaultDomToModelOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have a change that contains a similar fix with this one. https://github.com/microsoft/roosterjs/tree/u/jisong/pasteapi3
I feel it is ok to move paste back to be core API. Just two problems

  1. It is better to make the public paste API accept PasteType as parameter rather than "isImage", "isText", ... . We can solve this when we build the real standalone editor since for now it will be conflict with IEditor interface.
  2. Here we override the options to use editor's default options, which includes an override for Table, then we override it back to default one. I think we should just keep the options passed in by user, and do not add the table processor override at all here. To do that, we can save those override options separately in StandaloneEditorCore. E.g.:
interface StandaloneEditorCore {
  ...
  editingDomToModelOptions: DomToModelOptions; // For the table override
  customizedDomToModelOptions: DomToModelOptions; // For options passed in from editorOptions
}

Another option is to remove the tablePreProcessor at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you have a change already doing this, I think we can just wait for your PR then. Closing this for now.

@BryanValverdeU BryanValverdeU merged commit 4aa91a7 into master Dec 18, 2023
10 checks passed
@BryanValverdeU BryanValverdeU deleted the u/bvalverde/movePasteToCore branch December 18, 2023 21:11
JiuqingSong added a commit that referenced this pull request Jan 6, 2024
* change image

* Content Model: Better hide cursor for table and image selection (#2270)

* Standalone Editor: CreateStandaloneEditorCore

* Standalone Editor: Port LifecyclePlugin

* fix build

* fix test

* improve

* fix test

* Standalone Editor: Support keyboard input (init step)

* Standalone Editor: Port EntityPlugin

* improve

* Add test

* improve

* port selection api

* improve

* improve

* fix build

* fix build

* fix build

* improve

* Improve

* improve

* improve

* fix test

* improve

* add test

* remove unused code

* Standalone Editor: port ImageSelection plugin

* add test

* Standalone Editor: Port UndoPlugin

* improve

* Port undo api

* fix test

* improve

* improve

* fix build

* Improve

* Improve

* Improve

* fix build

* Improve

* Add test

* fix test

* Add undo/redo API

* Standalone Editor: Port event core API

* fix build

* fix build

* Standalone Editor: Port transformColor API

* Improve

* Content Model: Better hide cursor for table and image selection

* fix build

---------

Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>

* gif treatment

* Move Paste from publicApi to coreApi to leverage the same domToModelOptions #2275

* selection

* WIP

* fix mac image selection

* constant

* Standalone Editor: Port paste API step 1 (#2279)

* Standalone Editor: Port paste API step 2 (#2280)

* Standalone Editor: Port paste API step 1

* Standalone Editor: Port paste API step 2

* improve

* improve

* Table Fidelity improvement: Width Attribute and Cellpadding attribute (#2284)

* init

* add test

* update name of test

* adjust link selection

* Standalone Editor: Port paste API step 3 (#2281)

* Standalone Editor: Port paste API step 1

* Standalone Editor: Port paste API step 2

* Standalone Editor: Port paste API step 3

* improve

* improve

* Improve

* Improve

* Adjust Selection on Cut/Copy first table cell  (#2287)

* init

* fix

* address comments

* address additional scenario

* adjust space for underline

* adjust space for underline

* fix multiple blocks

* fixes

* Standalone Editor: Port paste API step 4 (#2282)

* Standalone Editor: Port paste API step 1

* Standalone Editor: Port paste API step 2

* Standalone Editor: Port paste API step 3

* Standalone Editor: Port paste API step 4

* improve

* improve

* fix test

* Standalone Editor: Decouple core package from roosterjs-editor-dom (#2283)

* Standalone Editor: Port paste API step 1

* Standalone Editor: Port paste API step 2

* Standalone Editor: Port paste API step 3

* Standalone Editor: Port paste API step 4

* Standalone Editor: Decouple core package from roosterjs-editor-dom

* Set Deprecated font color to black instead of undefined (#2290)

* init

* use jasmine anything

* Remove negative margins from Word (#2277)

* Remove negative margins from Word

* remove

* Standalone Editor step 1 (#2291)

* Fix GetFormatState not returning Font size after paste (#2299)

* init

* fix build

* Standalone Editor step 2 (#2292)

* keyboard input on mac

* fix test

* change isMac for isIME

* iscomposing

* Support rem unit (#2300)

* Support rem unit

* Use already existing case

* justify-content-api

* aligment list item

* add justify to map

* Content Model: Improve paste and sanitization behavior (#2304)

* Fix couple of issues in Word Desktop Paste (#2311)

* init

* fix build

* try fix build

* fix again

* Add a test

* Re-activate tested without model check

* Change borderLeft/Right to borderInlineStart/End (#2286)

* fix RTL border application

* fix table direction change

* add tests

* Update versions

---------

Co-authored-by: Júlia Roldi <juliaroldi@microsoft.com>
Co-authored-by: Jiuqing Song <jisong@microsoft.com>
Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>
Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com>
Co-authored-by: Andres-CT98 <107568016+Andres-CT98@users.noreply.github.com>
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.

3 participants