Skip to content

Commit

Permalink
fix: editing area invisble because _cursorChange
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Aug 8, 2024
1 parent 749da25 commit 1462b34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import type {
} from '@univerjs/engine-render';
import {
convertTextRotation,
DeviceInputEventType,
FIX_ONE_PIXEL_BLUR_OFFSET,
fixLineWidthByScale,
IRenderManagerService,
Expand Down Expand Up @@ -560,14 +561,14 @@ export class SlideEditingRenderController extends Disposable implements IRenderM
* startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
* @param param
*/
private _handleEditorVisible(_param: IEditorBridgeServiceVisibleParam) {
// const { eventType, keycode } = param;
private _handleEditorVisible(param: IEditorBridgeServiceVisibleParam) {
const { eventType, keycode } = param;

// Change `CursorChange` to changed status, when formula bar clicked.
// this._cursorChange =
// eventType === DeviceInputEventType.PointerDown
// ? CursorChange.CursorChange
// : CursorChange.StartEditor;
this._cursorChange =
[DeviceInputEventType.PointerDown, DeviceInputEventType.Dblclick].includes(eventType)
? CursorChange.CursorChange
: CursorChange.StartEditor;

const editCellState = this._editorBridgeService.getEditRectState();
if (editCellState == null) {
Expand Down Expand Up @@ -716,16 +717,13 @@ export class SlideEditingRenderController extends Disposable implements IRenderM
* the up, down, left, and right keys can no longer switch editing cells,
* but move the cursor within the editor instead.
*/
if (keycode != null &&
(this._cursorChange === CursorChange.CursorChange || this._contextService.getContextValue(FORMULA_EDITOR_ACTIVATED))
if (keycode != null && this._cursorChange === CursorChange.CursorChange
) {
this._moveInEditor(keycode, isShift);
return;
} else {
// TODO @Jocs: After we merging editor related controllers, this seems verbose.
this._editorBridgeService.changeVisible(params);
}

// TODO @Jocs: After we merging editor related controllers, this seems verbose.

this._editorBridgeService.changeVisible(params);
}

private _editingChangedHandler() {
Expand Down
4 changes: 2 additions & 2 deletions packages/slides/src/views/render/canvas-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ export class CanvasView extends RxDisposable implements IRenderModule {
}

private _sceneMap = new Map<string, Scene>();

/**
*
* @param pageId
* @param page
* @returns
* @returns pageScene: Scene
*/
private _createScene(pageId: string, page: ISlidePage) {
const render = this._currentRender();
Expand Down

0 comments on commit 1462b34

Please sign in to comment.