RESOLVED FIXED 189504
[Cocoa] Complete support for Paste as Quotation
https://bugs.webkit.org/show_bug.cgi?id=189504
Summary [Cocoa] Complete support for Paste as Quotation
mitz
Reported 2018-09-11 09:40:52 PDT
WebCore implements custom paste behavior for Paste as Quotation, which is triggered by the presence of a specific class attribute value on the blockquote element being pasted (see isMailPasteAsQuotationNode in ReplaceSeelctionCommand.cpp). This allows clients of the legacy API to create a document fragment that will get pasted as a quotation. To expose the same functionality to clients of the modern WebKit API, we can introduce an explicit Paste as Quotation command, which will take care of creating an enclosing blockquote with the appropriate class. In the future we can do away with using the class attribute to signal the desired behavior altogether.
Attachments
macOS-only patch to see what work needs to be done in other ports (11.94 KB, patch)
2018-09-11 09:41 PDT, mitz
no flags
Multi-platform patch for EWS (20.33 KB, patch)
2018-09-11 13:02 PDT, mitz
no flags
Multi-platform patch for EWS (20.28 KB, patch)
2018-09-11 13:16 PDT, mitz
no flags
Multi-platform patch for EWS (20.28 KB, patch)
2018-09-11 13:30 PDT, mitz
no flags
Multi-platform patch for EWS (22.57 KB, patch)
2018-09-11 14:24 PDT, mitz
no flags
Add PasteAsQuotation command and -[WKWebView _pasteAsQuotation:] (36.39 KB, patch)
2018-09-12 13:11 PDT, mitz
wenson_hsieh: review+
mitz
Comment 1 2018-09-11 09:41:41 PDT
Created attachment 349400 [details] macOS-only patch to see what work needs to be done in other ports
EWS Watchlist
Comment 2 2018-09-11 09:44:45 PDT
Attachment 349400 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:114: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 3 2018-09-11 13:02:38 PDT
Created attachment 349426 [details] Multi-platform patch for EWS
EWS Watchlist
Comment 4 2018-09-11 13:05:53 PDT
Attachment 349426 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:97: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 5 2018-09-11 13:16:36 PDT
Created attachment 349432 [details] Multi-platform patch for EWS
EWS Watchlist
Comment 6 2018-09-11 13:18:15 PDT
Attachment 349432 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:97: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 7 2018-09-11 13:30:20 PDT
Created attachment 349436 [details] Multi-platform patch for EWS
EWS Watchlist
Comment 8 2018-09-11 13:45:33 PDT
Attachment 349436 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:97: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 9 2018-09-11 14:24:51 PDT
Created attachment 349454 [details] Multi-platform patch for EWS
EWS Watchlist
Comment 10 2018-09-11 14:26:59 PDT
Attachment 349454 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:97: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 11 2018-09-12 13:11:53 PDT
Created attachment 349574 [details] Add PasteAsQuotation command and -[WKWebView _pasteAsQuotation:]
EWS Watchlist
Comment 12 2018-09-12 13:16:26 PDT
Attachment 349574 [details] did not pass style-queue: ERROR: Source/WebCore/editing/mac/EditorMac.mm:96: Extra space before ) [whitespace/parens] [2] Total errors found: 1 in 25 files If any of these errors are false positives, please file a bug against check-webkit-style.
Wenson Hsieh
Comment 13 2018-09-12 14:50:52 PDT
Comment on attachment 349574 [details] Add PasteAsQuotation command and -[WKWebView _pasteAsQuotation:] View in context: https://bugs.webkit.org/attachment.cgi?id=349574&action=review r=mews > Source/WebCore/editing/Editor.h:135 > + AsQuotation = 2 << 0, ‽‽‽‽ > LayoutTests/editing/pasteboard/4930986-1-paste-as-quotation.html:17 > +document.addEventListener("beforecopy", (event) => { event.preventDefault(); }); Nit - no need for the { } around the function body. > LayoutTests/editing/pasteboard/4930986-2-paste-as-quotation.html:13 > + document.addEventListener("beforecopy", (event) => { event.preventDefault(); }); (Ditto) > LayoutTests/editing/pasteboard/4930986-3-paste-as-quotation.html:17 > +document.addEventListener("beforecopy", (event) => { event.preventDefault(); }); (Ditto)
mitz
Comment 14 2018-09-12 15:21:38 PDT
Comment on attachment 349574 [details] Add PasteAsQuotation command and -[WKWebView _pasteAsQuotation:] View in context: https://bugs.webkit.org/attachment.cgi?id=349574&action=review >> Source/WebCore/editing/Editor.h:135 >> + AsQuotation = 2 << 0, > > ‽‽‽‽ The whole thing is unbelievable. >> LayoutTests/editing/pasteboard/4930986-1-paste-as-quotation.html:17 >> +document.addEventListener("beforecopy", (event) => { event.preventDefault(); }); > > Nit - no need for the { } around the function body. Nice.
mitz
Comment 15 2018-09-12 15:26:26 PDT
Radar WebKit Bug Importer
Comment 16 2018-09-12 15:27:21 PDT
Note You need to log in before you can comment on or make changes to this bug.