Compare commits
4 Commits
3fd57b0859
...
e9308b3986
Author | SHA1 | Date |
---|---|---|
Mauro Berlanda | e9308b3986 | |
Marcel Mraz | 6e5aeb112d | |
Marcel Mraz | 4d83d1c91e | |
Mauro Berlanda | f91b341d20 |
16
Dockerfile
16
Dockerfile
|
@ -12,6 +12,18 @@ RUN yarn build:app:docker
|
|||
|
||||
FROM nginx:1.21-alpine
|
||||
|
||||
COPY --from=build /opt/node_app/build /usr/share/nginx/html
|
||||
# Set a default value for PORT if it's not set
|
||||
# Using :80 for backward compatibility with the
|
||||
# original value in /etc/nginx/conf.d/default.conf
|
||||
ENV PORT=${PORT:-80}
|
||||
EXPOSE ${PORT}
|
||||
|
||||
HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1
|
||||
COPY --from=build /opt/node_app/build /usr/share/nginx/html
|
||||
COPY docker-config/nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
|
||||
COPY docker-config/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
|
||||
CMD wget -q -O /dev/null http://localhost:${PORT} || exit 1
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
/etc/init.d/nginx stop
|
||||
# Substitute the PORT in the Nginx config template and remove comments
|
||||
envsubst '$PORT' < /etc/nginx/conf.d/nginx.conf.template | grep -v '^#' > /etc/nginx/conf.d/default.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to update /etc/nginx/conf.d/default.conf. with port ${PORT}"
|
||||
exit 1
|
||||
fi
|
||||
/etc/init.d/nginx restart
|
||||
|
||||
exec "$@"
|
|
@ -0,0 +1,44 @@
|
|||
# /etc/nginx/conf.d/default.conf file found in nginx:1.21-alpine
|
||||
server {
|
||||
listen $PORT;
|
||||
server_name localhost;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
|
@ -4166,6 +4166,11 @@ class App extends React.Component<AppProps, AppState> {
|
|||
originSnapOffset: null,
|
||||
activeEmbeddable: null,
|
||||
} as const;
|
||||
|
||||
if (nextActiveTool.type === "freedraw") {
|
||||
this.store.shouldCaptureIncrement();
|
||||
}
|
||||
|
||||
if (nextActiveTool.type !== "selection") {
|
||||
return {
|
||||
...prevState,
|
||||
|
|
|
@ -22,7 +22,7 @@ export const getObservedAppState = (appState: AppState): ObservedAppState => {
|
|||
selectedLinearElementId: appState.selectedLinearElement?.elementId || null,
|
||||
};
|
||||
|
||||
Object.defineProperty(observedAppState, hiddenObservedAppStateProp, {
|
||||
Reflect.defineProperty(observedAppState, hiddenObservedAppStateProp, {
|
||||
value: true,
|
||||
enumerable: false,
|
||||
});
|
||||
|
@ -33,7 +33,7 @@ export const getObservedAppState = (appState: AppState): ObservedAppState => {
|
|||
const isObservedAppState = (
|
||||
appState: AppState | ObservedAppState,
|
||||
): appState is ObservedAppState =>
|
||||
Object.hasOwn(appState, hiddenObservedAppStateProp);
|
||||
!!Reflect.get(appState, hiddenObservedAppStateProp);
|
||||
|
||||
export type StoreActionType = "capture" | "update" | "none";
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6570,12 +6570,27 @@ History {
|
|||
"delta": Delta {
|
||||
"deleted": {
|
||||
"selectedElementIds": {},
|
||||
"selectedLinearElementId": null,
|
||||
},
|
||||
"inserted": {
|
||||
"selectedElementIds": {
|
||||
"id6": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"elementsChange": ElementsChange {
|
||||
"added": Map {},
|
||||
"removed": Map {},
|
||||
"updated": Map {},
|
||||
},
|
||||
},
|
||||
HistoryEntry {
|
||||
"appStateChange": AppStateChange {
|
||||
"delta": Delta {
|
||||
"deleted": {
|
||||
"selectedLinearElementId": null,
|
||||
},
|
||||
"inserted": {
|
||||
"selectedLinearElementId": "id6",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -15,7 +15,11 @@ import { createUndoAction, createRedoAction } from "../actions/actionHistory";
|
|||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { AppState, ExcalidrawImperativeAPI } from "../types";
|
||||
import { arrayToMap, resolvablePromise } from "../utils";
|
||||
import { COLOR_PALETTE } from "../colors";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
|
||||
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
||||
} from "../colors";
|
||||
import { KEYS } from "../keys";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import {
|
||||
|
@ -67,10 +71,11 @@ const checkpoint = (name: string) => {
|
|||
const renderStaticScene = vi.spyOn(StaticScene, "renderStaticScene");
|
||||
|
||||
const transparent = COLOR_PALETTE.transparent;
|
||||
const red = COLOR_PALETTE.red[1];
|
||||
const blue = COLOR_PALETTE.blue[1];
|
||||
const yellow = COLOR_PALETTE.yellow[1];
|
||||
const violet = COLOR_PALETTE.violet[1];
|
||||
const black = COLOR_PALETTE.black;
|
||||
const red = COLOR_PALETTE.red[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX];
|
||||
const blue = COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX];
|
||||
const yellow = COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX];
|
||||
const violet = COLOR_PALETTE.violet[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX];
|
||||
|
||||
describe("history", () => {
|
||||
beforeEach(() => {
|
||||
|
@ -973,6 +978,69 @@ describe("history", () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it("should create entry when selecting freedraw", async () => {
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
|
||||
UI.clickTool("rectangle");
|
||||
mouse.down(-10, -10);
|
||||
mouse.up(10, 10);
|
||||
|
||||
UI.clickTool("freedraw");
|
||||
mouse.down(40, -20);
|
||||
mouse.up(50, 10);
|
||||
|
||||
const rectangle = h.elements[0];
|
||||
const freedraw1 = h.elements[1];
|
||||
|
||||
expect(API.getUndoStack().length).toBe(3);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
expect(API.getSelectedElements().length).toBe(0);
|
||||
expect(h.elements).toEqual([
|
||||
expect.objectContaining({ id: rectangle.id }),
|
||||
expect.objectContaining({ id: freedraw1.id, strokeColor: black }),
|
||||
]);
|
||||
|
||||
Keyboard.undo();
|
||||
expect(API.getUndoStack().length).toBe(2);
|
||||
expect(API.getRedoStack().length).toBe(1);
|
||||
expect(API.getSelectedElements().length).toBe(0);
|
||||
expect(h.elements).toEqual([
|
||||
expect.objectContaining({ id: rectangle.id }),
|
||||
expect.objectContaining({
|
||||
id: freedraw1.id,
|
||||
strokeColor: black,
|
||||
isDeleted: true,
|
||||
}),
|
||||
]);
|
||||
|
||||
togglePopover("Stroke");
|
||||
UI.clickOnTestId("color-red");
|
||||
mouse.down(40, -20);
|
||||
mouse.up(50, 10);
|
||||
|
||||
const freedraw2 = h.elements[2];
|
||||
|
||||
expect(API.getUndoStack().length).toBe(3);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
expect(h.elements).toEqual([
|
||||
expect.objectContaining({ id: rectangle.id }),
|
||||
expect.objectContaining({
|
||||
id: freedraw1.id,
|
||||
strokeColor: black,
|
||||
isDeleted: true,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: freedraw2.id,
|
||||
strokeColor: COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
||||
}),
|
||||
]);
|
||||
|
||||
// ensure we don't end up with duplicated entries
|
||||
UI.clickTool("freedraw");
|
||||
expect(API.getUndoStack().length).toBe(3);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
});
|
||||
|
||||
it("should support duplication of groups, appstate group selection and editing group", async () => {
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
const rect1 = API.createElement({
|
||||
|
|
Loading…
Reference in New Issue