Skip to content

Commit

Permalink
🎨 数据库块适配外观和宽度调整
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 14, 2023
1 parent a20ffeb commit 9978827
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {insertHTML} from "../util/insertHTML";
import {removeSearchMark} from "../toolbar/util";
import {copyPNG} from "../../menus/util";
import {avKeydown} from "../render/av/keydown";
import {resizeAV} from "../util/resize";


const getContentByInlineHTML = (range: Range, cb: (content: string) => void) => {
Expand Down Expand Up @@ -1174,7 +1175,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
selectElements = [nodeElement];
}
updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {
e.style.textAlign = "left";
if (e.classList.contains("av")) {
e.style.margin = ""
resizeAV(e);
} else {
e.style.textAlign = "left";
}
});
}
event.stopPropagation();
Expand All @@ -1191,7 +1197,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
selectElements = [nodeElement];
}
updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {
e.style.textAlign = "center";
if (e.classList.contains("av")) {
e.style.margin = "0 auto"
resizeAV(e);
} else {
e.style.textAlign = "center";
}
});
}
event.stopPropagation();
Expand All @@ -1204,7 +1215,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
selectElements = [nodeElement];
}
updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {
e.style.textAlign = "right";
if (e.classList.contains("av")) {
e.style.margin = "0 0 0 auto";
resizeAV(e);
} else {
e.style.textAlign = "right";
}
});
event.stopPropagation();
event.preventDefault();
Expand Down

0 comments on commit 9978827

Please sign in to comment.