mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-09 15:24:25 +01:00
Compare commits
1 Commits
zsviczian-
...
zsviczian-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61cf47a403 |
@@ -201,12 +201,23 @@ export const actionChangeStrokeColor = register({
|
|||||||
name: "changeStrokeColor",
|
name: "changeStrokeColor",
|
||||||
trackEvent: false,
|
trackEvent: false,
|
||||||
perform: (elements, appState, value) => {
|
perform: (elements, appState, value) => {
|
||||||
|
const containers = getSelectedElements(elements, appState, false)
|
||||||
|
.filter((el) => el.boundElements)
|
||||||
|
.map((el) => el.id);
|
||||||
return {
|
return {
|
||||||
...(value.currentItemStrokeColor && {
|
...(value.currentItemStrokeColor && {
|
||||||
elements: changeProperty(
|
elements: changeProperty(
|
||||||
elements,
|
elements,
|
||||||
appState,
|
appState,
|
||||||
(el) => {
|
(el) => {
|
||||||
|
if (
|
||||||
|
isTextElement(el) &&
|
||||||
|
el.containerId &&
|
||||||
|
containers.includes(el.containerId) &&
|
||||||
|
getContainerElement(el)?.strokeColor !== el.strokeColor
|
||||||
|
) {
|
||||||
|
return el;
|
||||||
|
}
|
||||||
return hasStrokeColor(el.type)
|
return hasStrokeColor(el.type)
|
||||||
? newElementWith(el, {
|
? newElementWith(el, {
|
||||||
strokeColor: value.currentItemStrokeColor,
|
strokeColor: value.currentItemStrokeColor,
|
||||||
|
|||||||
@@ -325,6 +325,8 @@ export const textWysiwyg = ({
|
|||||||
whiteSpace = "pre-wrap";
|
whiteSpace = "pre-wrap";
|
||||||
wordBreak = "break-word";
|
wordBreak = "break-word";
|
||||||
}
|
}
|
||||||
|
const isContainerArrow = isArrowElement(getContainerElement(element));
|
||||||
|
const background = isContainerArrow ? "#fff" : "transparent";
|
||||||
Object.assign(editable.style, {
|
Object.assign(editable.style, {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
display: "inline-block",
|
display: "inline-block",
|
||||||
@@ -335,7 +337,7 @@ export const textWysiwyg = ({
|
|||||||
border: 0,
|
border: 0,
|
||||||
outline: 0,
|
outline: 0,
|
||||||
resize: "none",
|
resize: "none",
|
||||||
background: "transparent",
|
background,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
// must be specified because in dark mode canvas creates a stacking context
|
// must be specified because in dark mode canvas creates a stacking context
|
||||||
zIndex: "var(--zIndex-wysiwyg)",
|
zIndex: "var(--zIndex-wysiwyg)",
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`Test Linear Elements Test bound text element should match styles for text editor 1`] = `
|
|
||||||
<textarea
|
|
||||||
class="excalidraw-wysiwyg"
|
|
||||||
data-type="wysiwyg"
|
|
||||||
dir="auto"
|
|
||||||
style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 0px; height: 0px; left: 40px; top: 20px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -20px; font: Emoji 20px 20px; line-height: 0px; font-family: Virgil, Segoe UI Emoji;"
|
|
||||||
tabindex="0"
|
|
||||||
wrap="off"
|
|
||||||
/>
|
|
||||||
`;
|
|
||||||
@@ -829,15 +829,6 @@ describe("Test Linear Elements", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should match styles for text editor", () => {
|
|
||||||
createTwoPointerLinearElement("arrow");
|
|
||||||
Keyboard.keyPress(KEYS.ENTER);
|
|
||||||
const editor = document.querySelector(
|
|
||||||
".excalidraw-textEditorContainer > textarea",
|
|
||||||
) as HTMLTextAreaElement;
|
|
||||||
expect(editor).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should bind text to arrow when double clicked", async () => {
|
it("should bind text to arrow when double clicked", async () => {
|
||||||
createTwoPointerLinearElement("arrow");
|
createTwoPointerLinearElement("arrow");
|
||||||
const arrow = h.elements[0] as ExcalidrawLinearElement;
|
const arrow = h.elements[0] as ExcalidrawLinearElement;
|
||||||
|
|||||||
Reference in New Issue
Block a user