mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🔧 Fix tab rendering with the text editor
This commit is contained in:
committed by
Alejandro Alonso
parent
54489c4285
commit
d18a018236
133
frontend/playwright/data/render-wasm/get-file-text-tabs.json
Normal file
133
frontend/playwright/data/render-wasm/get-file-text-tabs.json
Normal file
File diff suppressed because one or more lines are too long
@@ -347,6 +347,26 @@ test("Renders a file with texts with with text spans of different sizes", async
|
|||||||
await expect(workspace.canvas).toHaveScreenshot();
|
await expect(workspace.canvas).toHaveScreenshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Renders a file with texts with tabs", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const workspace = new WasmWorkspacePage(page);
|
||||||
|
await workspace.setupEmptyFile();
|
||||||
|
await workspace.mockGetFile("render-wasm/get-file-text-tabs.json");
|
||||||
|
|
||||||
|
await workspace.goToWorkspace({
|
||||||
|
id: "55ed444c-1179-8175-8007-09da51f502e7",
|
||||||
|
pageId: "55ed444c-1179-8175-8007-09da51f502e8",
|
||||||
|
});
|
||||||
|
|
||||||
|
await workspace.waitForFirstRender({ hideUI: false });
|
||||||
|
await workspace.clickLeafLayer("shape-list");
|
||||||
|
await workspace.hideUI();
|
||||||
|
await workspace.page.keyboard.press("Enter");
|
||||||
|
|
||||||
|
await expect(workspace.canvas).toHaveScreenshot();
|
||||||
|
});
|
||||||
|
|
||||||
test.skip("Updates text alignment edition - part 1", async ({ page }) => {
|
test.skip("Updates text alignment edition - part 1", async ({ page }) => {
|
||||||
const workspace = new WasmWorkspacePage(page);
|
const workspace = new WasmWorkspacePage(page);
|
||||||
await workspace.setupEmptyFile();
|
await workspace.setupEmptyFile();
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
@@ -3,6 +3,7 @@ import { WasmWorkspacePage } from "../pages/WasmWorkspacePage";
|
|||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await WasmWorkspacePage.init(page);
|
await WasmWorkspacePage.init(page);
|
||||||
|
await WasmWorkspacePage.mockConfigFlags(page, ["enable-feature-text-editor-v2"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("BUG 10867 - Crash when loading comments", async ({ page }) => {
|
test("BUG 10867 - Crash when loading comments", async ({ page }) => {
|
||||||
|
|||||||
@@ -35,9 +35,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[data-itype="inline"] {
|
[data-itype="inline"] {
|
||||||
|
display: inline-block;
|
||||||
line-break: auto;
|
line-break: auto;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
caret-color: var(--text-editor-caret-color);
|
caret-color: var(--text-editor-caret-color);
|
||||||
|
|
||||||
|
// firefox-only
|
||||||
|
white-space: preserve-spaces;
|
||||||
|
|
||||||
|
// others
|
||||||
|
white-space-collapse: pre;
|
||||||
|
tab-size: 2;
|
||||||
|
-o-tab-size: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-itype="root"] {
|
[data-itype="root"] {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
text-direction (sr/translate-text-direction (get paragraph :text-direction))
|
text-direction (sr/translate-text-direction (get paragraph :text-direction))
|
||||||
text-decoration (sr/translate-text-decoration (get paragraph :text-decoration))
|
text-decoration (sr/translate-text-decoration (get paragraph :text-decoration))
|
||||||
text-transform (sr/translate-text-transform (get paragraph :text-transform))
|
text-transform (sr/translate-text-transform (get paragraph :text-transform))
|
||||||
line-height (get paragraph :line-height)
|
line-height (get paragraph :line-height 1.2)
|
||||||
letter-spacing (get paragraph :letter-spacing)]
|
letter-spacing (get paragraph :letter-spacing)]
|
||||||
|
|
||||||
(-> offset
|
(-> offset
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
[offset dview spans paragraph]
|
[offset dview spans paragraph]
|
||||||
(let [paragraph-font-size (get paragraph :font-size)
|
(let [paragraph-font-size (get paragraph :font-size)
|
||||||
paragraph-font-weight (-> paragraph :font-weight f/serialize-font-weight)
|
paragraph-font-weight (-> paragraph :font-weight f/serialize-font-weight)
|
||||||
paragraph-line-height (get paragraph :line-height)]
|
paragraph-line-height (get paragraph :line-height 1.2)]
|
||||||
(reduce (fn [offset span]
|
(reduce (fn [offset span]
|
||||||
(let [font-style (sr/translate-font-style (get span :font-style "normal"))
|
(let [font-style (sr/translate-font-style (get span :font-style "normal"))
|
||||||
font-size (get span :font-size paragraph-font-size)
|
font-size (get span :font-size paragraph-font-size)
|
||||||
|
|||||||
@@ -603,8 +603,10 @@ impl Paragraph {
|
|||||||
pub fn paragraph_to_style(&self) -> ParagraphStyle {
|
pub fn paragraph_to_style(&self) -> ParagraphStyle {
|
||||||
let mut style = ParagraphStyle::default();
|
let mut style = ParagraphStyle::default();
|
||||||
|
|
||||||
|
style.set_height(self.line_height);
|
||||||
style.set_text_align(self.text_align);
|
style.set_text_align(self.text_align);
|
||||||
style.set_text_direction(self.text_direction);
|
style.set_text_direction(self.text_direction);
|
||||||
|
style.set_replace_tab_characters(true);
|
||||||
style.set_text_height_behavior(skia::textlayout::TextHeightBehavior::All);
|
style.set_text_height_behavior(skia::textlayout::TextHeightBehavior::All);
|
||||||
style
|
style
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user