回答編集履歴

1

回避策を追記

2022/07/26 04:13

投稿

itagagaki
itagagaki

スコア8402

test CHANGED
@@ -2,3 +2,18 @@
2
2
  直っていないということはバグではなく仕様ということになったのか、それともただ放置されているのか…
3
3
 
4
4
  [116429 - Linebreaks/newlines missing from chrome.contextMenus selectionText - chromium](https://bugs.chromium.org/p/chromium/issues/detail?id=116429)
5
+
6
+ このコメントに回避策が載っています。
7
+
8
+
9
+ ```
10
+ chrome.tabs.executeScript( {
11
+ code: "window.getSelection().toString();"
12
+ }, function(selection) {
13
+ // selected contains text including line breaks
14
+ var selected = selection[0];
15
+ });
16
+ ```
17
+
18
+ "tabs" パーミッションが必要。
19
+