Skip to content

Commit

Permalink
要在当前聚焦的页签中搜索元素
Browse files Browse the repository at this point in the history
  • Loading branch information
TCOTC committed Apr 18, 2024
1 parent f3348b9 commit d66abe1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const SearchComponent = {
onMounted(() => {
const rootElement = document.querySelector(`.${CLASS_NAME}`);
if (rootElement) {
const inputElement = rootElement.querySelector('.search-dialog .b3-text-field');
const inputElement = rootElement.querySelector('.layout__center [data-type='wnd'].layout__wnd--active > .layout-tab-container .search-dialog .b3-text-field');// 要在当前聚焦的页签中搜索元素
if (inputElement) {
setTimeout(() => { // 等待一小段时间确保元素加载完全
inputElement.focus();
Expand Down Expand Up @@ -82,7 +82,7 @@ export default class PluginHighlight extends Plugin {
// 如果存在具有 CLASS_NAME 类名的元素,则执行以下操作
const rootElement = existingElement; // 将已存在的元素作为根元素
// 查找具有 CLASS_NAME 类名的根元素
const inputElement = rootElement.querySelector('.search-dialog .b3-text-field');
const inputElement = rootElement.querySelector('.layout__center [data-type='wnd'].layout__wnd--active > .layout-tab-container .search-dialog .b3-text-field');// 要在当前聚焦的页签中搜索元素
if (inputElement) {
// 等待一小段时间确保元素加载完全,然后聚焦到输入框并选中其中的文本
setTimeout(() => {
Expand Down

0 comments on commit d66abe1

Please sign in to comment.