Skip to content

Commit

Permalink
fix: scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
siam-ese committed Dec 30, 2024
1 parent b8f8fcb commit deede09
Show file tree
Hide file tree
Showing 17 changed files with 140 additions and 187 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/sync-to-clipsheet.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: 🔫 Sync to Clipsheet

on:
push:
branches:
- dev
push:
branches:
- dev

jobs:
update-submodules:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dream-num/univer-clipsheet
token: ${{ secrets.GH_TOKEN }}
submodules: true

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Update submodules (univer-clipsheet-core)
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cd submodules/univer-clipsheet-core
git checkout dev
git pull
commit_hash=$(git log -1 --pretty=format:"%h")
cd ../../
pnpm install --no-frozen-lockfile
git add -A
git commit -m "chore(submodules): update submodules($commit_hash)" || exit 0
git push
update-submodules:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dream-num/univer-clipsheet
token: ${{ secrets.GH_TOKEN }}
submodules: true

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Update submodules (univer-clipsheet-core)
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cd submodules/univer-clipsheet-core
git checkout dev
git pull
commit_hash=$(git log -1 --pretty=format:"%h")
cd ../../
pnpm install --no-frozen-lockfile
git add -A
git commit -m "chore(submodules): update submodules($commit_hash)" || exit 0
git push
66 changes: 33 additions & 33 deletions .github/workflows/sync-to-crx.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: 🔫 Sync to Crx

on:
push:
branches:
- dev
push:
branches:
- dev

jobs:
update-submodules:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dream-num/univer-crx
token: ${{ secrets.GH_TOKEN }}
submodules: true

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Update submodules (univer-clipsheet-core)
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cd submodules/univer-clipsheet-core
git checkout dev
git pull
commit_hash=$(git log -1 --pretty=format:"%h")
cd ../../
pnpm install --no-frozen-lockfile
git add -A
git commit -m "chore(submodules): update submodules($commit_hash)" || exit 0
git push
update-submodules:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dream-num/univer-crx
token: ${{ secrets.GH_TOKEN }}
submodules: true

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Update submodules (univer-clipsheet-core)
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cd submodules/univer-clipsheet-core
git checkout dev
git pull
commit_hash=$(git log -1 --pretty=format:"%h")
cd ../../
pnpm install --no-frozen-lockfile
git add -A
git commit -m "chore(submodules): update submodules($commit_hash)" || exit 0
git push
6 changes: 5 additions & 1 deletion packages/scraper/lib/scraper-service/scraper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,13 @@ export class ScraperService {
return;
}

chrome.tabs.update(tab.id, {
await chrome.tabs.update(tab.id, {
active: true,
});

chrome.tabs.sendMessage(tab.id, {
type: ClipsheetMessageTypeEnum.TabActivated,
});
break;
}
// When page loaded and if it is created by scraper tab will start to scrape
Expand Down
10 changes: 9 additions & 1 deletion packages/shared/lib/common.message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { IMessageWithPayload } from './messages';
import type { IMessage, IMessageWithPayload } from './messages';
import { promisifyMessage } from './tools';

export enum ClipsheetMessageTypeEnum {
DomContentLoaded = 'dom_content_loaded',
Expand All @@ -11,6 +12,7 @@ export enum ClipsheetMessageTypeEnum {
GetDataSource = 'get_data_source',
PushDataSource = 'push_data_source',
ActiveTab = 'active_tab',
TabActivated = 'tab_activated',
ReportPrintInfo = 'report_print_info',
}

Expand All @@ -27,6 +29,8 @@ export type GetDataSourceMessage<K extends string, T = unknown> = IMessageWithPa

export type PushDataSourceMessage<T = unknown> = IMessageWithPayload<ClipsheetMessageTypeEnum.PushDataSource, { key: string; value: T }>;
export type ActiveTabMessage = IMessageWithPayload<ClipsheetMessageTypeEnum.ActiveTab, chrome.tabs.Tab | undefined>;
export type TabActivatedMessage = IMessage<ClipsheetMessageTypeEnum.TabActivated>;

export type ReportPrintInfoMessage = IMessageWithPayload<ClipsheetMessageTypeEnum.ReportPrintInfo, any[]>;

export function sendActiveTabMessage(tab?: chrome.tabs.Tab) {
Expand All @@ -37,6 +41,10 @@ export function sendActiveTabMessage(tab?: chrome.tabs.Tab) {
chrome.runtime.sendMessage(message);
}

export function waitTabActivatedMessage(): Promise<TabActivatedMessage> {
return promisifyMessage<TabActivatedMessage>((msg) => msg.type === ClipsheetMessageTypeEnum.TabActivated);
}

export function sendReportPrintInfoMessage(...infos: any[]) {
const message: ReportPrintInfoMessage = {
type: ClipsheetMessageTypeEnum.ReportPrintInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ export class StorageService {
}
case ClipsheetMessageTypeEnum.SetStorage: {
const { key, value } = msg.payload;
// if (key === UIStorageKeyEnum.IframeView) {
// console.log('set iframe view', value);
// console.log('set iframe view sender', sender);
// }

this.setStorage(key, value);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ function analyzeApproximatedTable(element: Element, config?: IWorkAroundForEspec
if (classKey.length === 0) {
classKey = 'UniverBlankClassKey000'; // 如果类名为空,设置一个默认值
}
if (!isAspectRatioNormal(childElement) || !childElement.innerText) {
if (!isAspectRatioNormal(childElement) && !childElement.innerText) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/table/lib/table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class LocalTableDataSource implements ITableDataSource {
const record: ITableRecord = {
...payload.record,
triggerId: payload.triggerId,
createdAt: Date.now(),
createdAt: Date.now() / 1000,
value: '',
};

Expand Down
3 changes: 1 addition & 2 deletions packages/table/lib/table.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class TableService {
const inProgressTableRecord: ITableRecord = {
...payload.record,
id: inProgressTableRecordId,
createdAt: Date.now(),
createdAt: Date.now() / 1000,
recordType: payload.record.recordType,
value: '',
};
Expand All @@ -51,7 +51,6 @@ export class TableService {
if (_params) {
this._latestParams = _params;
}
// console.log('TableService:pushTableRecords', await this._tableDataSource.getList(this._latestParams));

return pushDataSource(TableDataSourceKeyEnum.TableRecords, await this._tableDataSource.getList(this._latestParams), tabId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class ElementInspectShadowComponent extends ShadowComponent {
}
evt.preventDefault();
evt.stopPropagation();
// console.log('ElementInspectController.onClick', this.$target);

this.clickedTarget$.next(this.$target);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class ElementInspectService {
const { shadowComponent } = this;
switch (msg.type) {
case ElementInspectMessageTypeEnum.ConnectElementInspection: {
// console.log('connect element inspection');
shadowComponent.activate();
shadowComponent.onInspectElement((el) => {
const res: ResponseElementInspectionMessage = {
Expand Down
Loading

0 comments on commit deede09

Please sign in to comment.