Skip to content

Commit

Permalink
fix bard writing
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Feb 5, 2024
1 parent 109bec2 commit 30404cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions doc/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Mouseover Translate Any Language At Once
English, Russian, Japanese, Chinese and so on

# Change Log
- 0.1.120
- fix bard text writing (request by Enlight432)
- 0.1.119
- fix ocr build conflict
- 0.1.118
Expand Down
17 changes: 10 additions & 7 deletions src/contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,20 @@ async function makeNonEnglishTypingFinish() {
}

async function insertText(text) {
var writingBox = util.getFocusedWritingBox();
if (!text) {
return;
}
if (util.isGoogleDoc()) {
} else if (util.isGoogleDoc()) {
pasteTextGoogleDoc(text);
} else if ($(writingBox).is("[data-gramm='false']")) {
//for bard website
document.execCommand("insertText", false, text);
} else {
pasteTextInputBox(text);
}
await delay(10);
if (hasSelection()) {
document.execCommand("insertText", false, text);
await delay(10);
if (hasSelection()) {
document.execCommand("insertText", false, text);
}
}
}

Expand Down Expand Up @@ -646,7 +649,7 @@ function applyStyleSetting() {
background-color: ${setting["tooltipBackgroundColor"]} !important;
color: ${setting["tooltipFontColor"]} !important;
overflow-wrap: break-word !important;
font-family: Arial !important;
font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
border: 1px solid ${setting["tooltipBorderColor"]};
}
[data-tippy-root] {
Expand Down
4 changes: 1 addition & 3 deletions src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,7 @@ export function getActiveElement(root = document) {

if (!activeEl) {
return null;
}

if (activeEl.shadowRoot) {
} else if (activeEl.shadowRoot) {
return getActiveElement(activeEl.shadowRoot);
} else {
return activeEl;
Expand Down

0 comments on commit 30404cb

Please sign in to comment.