refactor: remove watermark code (#3639)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
David Luzar 2021-05-26 21:44:54 +02:00 committed by GitHub
parent abebf9aff8
commit dd12abc583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 21 additions and 200 deletions

View File

@ -55,7 +55,6 @@ export const actionClearCanvas = register({
exportBackground: appState.exportBackground, exportBackground: appState.exportBackground,
exportEmbedScene: appState.exportEmbedScene, exportEmbedScene: appState.exportEmbedScene,
gridSize: appState.gridSize, gridSize: appState.gridSize,
shouldAddWatermark: appState.shouldAddWatermark,
showStats: appState.showStats, showStats: appState.showStats,
pasteDialog: appState.pasteDialog, pasteDialog: appState.pasteDialog,
}, },

View File

@ -71,24 +71,6 @@ export const actionChangeExportEmbedScene = register({
), ),
}); });
export const actionChangeShouldAddWatermark = register({
name: "changeShouldAddWatermark",
perform: (_elements, appState, value) => {
return {
appState: { ...appState, shouldAddWatermark: value },
commitToHistory: false,
};
},
PanelComponent: ({ appState, updateData }) => (
<CheckboxItem
checked={appState.shouldAddWatermark}
onChange={(checked) => updateData(checked)}
>
{t("labels.addWatermark")}
</CheckboxItem>
),
});
export const actionSaveScene = register({ export const actionSaveScene = register({
name: "saveScene", name: "saveScene",
perform: async (elements, appState, value) => { perform: async (elements, appState, value) => {

View File

@ -66,7 +66,6 @@ export type ActionName =
| "changeProjectName" | "changeProjectName"
| "changeExportBackground" | "changeExportBackground"
| "changeExportEmbedScene" | "changeExportEmbedScene"
| "changeShouldAddWatermark"
| "saveScene" | "saveScene"
| "saveAsScene" | "saveAsScene"
| "loadScene" | "loadScene"

View File

@ -61,7 +61,6 @@ export const getDefaultAppState = (): Omit<
selectedElementIds: {}, selectedElementIds: {},
selectedGroupIds: {}, selectedGroupIds: {},
selectionElement: null, selectionElement: null,
shouldAddWatermark: false,
shouldCacheIgnoreZoom: false, shouldCacheIgnoreZoom: false,
showHelpDialog: false, showHelpDialog: false,
showStats: false, showStats: false,
@ -141,7 +140,6 @@ const APP_STATE_STORAGE_CONF = (<
selectedElementIds: { browser: true, export: false }, selectedElementIds: { browser: true, export: false },
selectedGroupIds: { browser: true, export: false }, selectedGroupIds: { browser: true, export: false },
selectionElement: { browser: false, export: false }, selectionElement: { browser: false, export: false },
shouldAddWatermark: { browser: true, export: false },
shouldCacheIgnoreZoom: { browser: true, export: false }, shouldCacheIgnoreZoom: { browser: true, export: false },
showHelpDialog: { browser: false, export: false }, showHelpDialog: { browser: false, export: false },
showStats: { browser: true, export: false }, showStats: { browser: true, export: false },

View File

@ -101,11 +101,7 @@ const ImageExportModal = ({
const [scale, setScale] = useState(defaultScale); const [scale, setScale] = useState(defaultScale);
const [exportSelected, setExportSelected] = useState(someElementIsSelected); const [exportSelected, setExportSelected] = useState(someElementIsSelected);
const previewRef = useRef<HTMLDivElement>(null); const previewRef = useRef<HTMLDivElement>(null);
const { const { exportBackground, viewBackgroundColor } = appState;
exportBackground,
viewBackgroundColor,
shouldAddWatermark,
} = appState;
const exportedElements = exportSelected const exportedElements = exportSelected
? getSelectedElements(elements, appState) ? getSelectedElements(elements, appState)
@ -126,7 +122,6 @@ const ImageExportModal = ({
viewBackgroundColor, viewBackgroundColor,
exportPadding, exportPadding,
scale, scale,
shouldAddWatermark,
}); });
// if converting to blob fails, there's some problem that will // if converting to blob fails, there's some problem that will
@ -150,7 +145,6 @@ const ImageExportModal = ({
exportPadding, exportPadding,
viewBackgroundColor, viewBackgroundColor,
scale, scale,
shouldAddWatermark,
]); ]);
return ( return (
@ -186,7 +180,6 @@ const ImageExportModal = ({
const [width, height] = getExportSize( const [width, height] = getExportSize(
exportedElements, exportedElements,
exportPadding, exportPadding,
shouldAddWatermark,
_scale, _scale,
); );

View File

@ -419,7 +419,6 @@ const LayerUI = ({
name: appState.name, name: appState.name,
viewBackgroundColor: appState.viewBackgroundColor, viewBackgroundColor: appState.viewBackgroundColor,
scale, scale,
shouldAddWatermark: appState.shouldAddWatermark,
}) })
.catch(muteFSAbortError) .catch(muteFSAbortError)
.catch((error) => { .catch((error) => {

View File

@ -39,7 +39,6 @@ export const LibraryUnit = ({
const svg = exportToSvg(elementsToRender, { const svg = exportToSvg(elementsToRender, {
exportBackground: false, exportBackground: false,
viewBackgroundColor: oc.white, viewBackgroundColor: oc.white,
shouldAddWatermark: false,
}); });
for (const child of ref.current!.children) { for (const child of ref.current!.children) {
if (child.tagName !== "svg") { if (child.tagName !== "svg") {

View File

@ -38,7 +38,6 @@ const ChartPreviewBtn = (props: {
const svg = exportToSvg(elements, { const svg = exportToSvg(elements, {
exportBackground: false, exportBackground: false,
viewBackgroundColor: oc.white, viewBackgroundColor: oc.white,
shouldAddWatermark: false,
}); });
const previewNode = previewRef.current!; const previewNode = previewRef.current!;

View File

@ -24,14 +24,12 @@ export const exportCanvas = async (
viewBackgroundColor, viewBackgroundColor,
name, name,
scale = 1, scale = 1,
shouldAddWatermark,
}: { }: {
exportBackground: boolean; exportBackground: boolean;
exportPadding?: number; exportPadding?: number;
viewBackgroundColor: string; viewBackgroundColor: string;
name: string; name: string;
scale?: number; scale?: number;
shouldAddWatermark: boolean;
}, },
) => { ) => {
if (elements.length === 0) { if (elements.length === 0) {
@ -44,7 +42,6 @@ export const exportCanvas = async (
viewBackgroundColor, viewBackgroundColor,
exportPadding, exportPadding,
scale, scale,
shouldAddWatermark,
metadata: metadata:
appState.exportEmbedScene && type === "svg" appState.exportEmbedScene && type === "svg"
? await ( ? await (
@ -71,7 +68,6 @@ export const exportCanvas = async (
viewBackgroundColor, viewBackgroundColor,
exportPadding, exportPadding,
scale, scale,
shouldAddWatermark,
}); });
tempCanvas.style.display = "none"; tempCanvas.style.display = "none";
document.body.appendChild(tempCanvas); document.body.appendChild(tempCanvas);

View File

@ -69,7 +69,6 @@ const canvas = exportToCanvas(
{ {
exportBackground: true, exportBackground: true,
viewBackgroundColor: "#ffffff", viewBackgroundColor: "#ffffff",
shouldAddWatermark: false,
scale: 1, scale: 1,
}, },
createCanvas, createCanvas,

View File

@ -11,6 +11,17 @@ The change should be grouped under one of the below section and must contain PR
Please add the latest change on the top under the correct section. Please add the latest change on the top under the correct section.
--> -->
## Unreleased
## Excalidraw API
### Refactor
#### BREAKING CHANGE
- Removed `shouldAddWatermark: boolean` attribute from options for [export](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#export-utilities) APIs [#3639](https://github.com/excalidraw/excalidraw/pull/3639).
- Removed `appState.shouldAddWatermark` so in case you were passing `shouldAddWatermark` in [initialData.AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) it will not work anymore.
## 0.8.0 (2021-05-15) ## 0.8.0 (2021-05-15)
## Excalidraw API ## Excalidraw API

View File

@ -823,5 +823,4 @@ This function returns a svg with the exported elements.
| --- | --- | --- | --- | | --- | --- | --- | --- |
| exportBackground | boolean | true | Indicates whether background should be exported | | exportBackground | boolean | true | Indicates whether background should be exported |
| viewBackgroundColor | string | #fff | The default background color | | viewBackgroundColor | string | #fff | The default background color |
| shouldAddWatermark | boolean | false | Indicates whether watermark should be exported |
| exportWithDarkMode | boolean | false | Indicates whether to export with dark mode | | exportWithDarkMode | boolean | false | Indicates whether to export with dark mode |

View File

@ -829,5 +829,4 @@ This function returns a svg with the exported elements.
| --- | --- | --- | --- | | --- | --- | --- | --- |
| exportBackground | boolean | true | Indicates whether background should be exported | | exportBackground | boolean | true | Indicates whether background should be exported |
| viewBackgroundColor | string | #fff | The default background color | | viewBackgroundColor | string | #fff | The default background color |
| shouldAddWatermark | boolean | false | Indicates whether watermark should be exported |
| exportWithDarkMode | boolean | false | Indicates whether to export with dark mode | | exportWithDarkMode | boolean | false | Indicates whether to export with dark mode |

View File

@ -26,15 +26,11 @@ export const exportToCanvas = ({
{ elements, appState }, { elements, appState },
null, null,
); );
const { const { exportBackground, viewBackgroundColor } = restoredAppState;
exportBackground,
viewBackgroundColor,
shouldAddWatermark,
} = restoredAppState;
return _exportToCanvas( return _exportToCanvas(
getNonDeletedElements(restoredElements), getNonDeletedElements(restoredElements),
{ ...restoredAppState, offsetTop: 0, offsetLeft: 0, width: 0, height: 0 }, { ...restoredAppState, offsetTop: 0, offsetLeft: 0, width: 0, height: 0 },
{ exportBackground, viewBackgroundColor, shouldAddWatermark }, { exportBackground, viewBackgroundColor },
(width: number, height: number) => { (width: number, height: number) => {
const canvas = document.createElement("canvas"); const canvas = document.createElement("canvas");
const ret = getDimensions(width, height); const ret = getDimensions(width, height);

View File

@ -1,21 +1,13 @@
import rough from "roughjs/bin/rough"; import rough from "roughjs/bin/rough";
import oc from "open-color";
import { newTextElement } from "../element";
import { NonDeletedExcalidrawElement } from "../element/types"; import { NonDeletedExcalidrawElement } from "../element/types";
import { getCommonBounds } from "../element/bounds"; import { getCommonBounds } from "../element/bounds";
import { renderScene, renderSceneToSvg } from "../renderer/renderScene"; import { renderScene, renderSceneToSvg } from "../renderer/renderScene";
import { distance, SVG_NS } from "../utils"; import { distance, SVG_NS } from "../utils";
import { AppState } from "../types"; import { AppState } from "../types";
import { t } from "../i18n"; import { THEME_FILTER } from "../constants";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_VERTICAL_ALIGN,
THEME_FILTER,
} from "../constants";
import { getDefaultAppState } from "../appState"; import { getDefaultAppState } from "../appState";
export const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`; export const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
const WATERMARK_HEIGHT = 16;
export const exportToCanvas = ( export const exportToCanvas = (
elements: readonly NonDeletedExcalidrawElement[], elements: readonly NonDeletedExcalidrawElement[],
@ -25,13 +17,11 @@ export const exportToCanvas = (
exportPadding = 10, exportPadding = 10,
viewBackgroundColor, viewBackgroundColor,
scale = 1, scale = 1,
shouldAddWatermark,
}: { }: {
exportBackground: boolean; exportBackground: boolean;
exportPadding?: number; exportPadding?: number;
scale?: number; scale?: number;
viewBackgroundColor: string; viewBackgroundColor: string;
shouldAddWatermark: boolean;
}, },
createCanvas: ( createCanvas: (
width: number, width: number,
@ -43,13 +33,7 @@ export const exportToCanvas = (
return { canvas: tempCanvas, scale }; return { canvas: tempCanvas, scale };
}, },
) => { ) => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark); const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);
const [minX, minY, width, height] = getCanvasSize(
sceneElements,
exportPadding,
shouldAddWatermark,
);
const { canvas: tempCanvas, scale: newScale = scale } = createCanvas( const { canvas: tempCanvas, scale: newScale = scale } = createCanvas(
width, width,
@ -57,7 +41,7 @@ export const exportToCanvas = (
); );
renderScene( renderScene(
sceneElements, elements,
appState, appState,
null, null,
newScale, newScale,
@ -94,7 +78,6 @@ export const exportToSvg = (
viewBackgroundColor, viewBackgroundColor,
exportWithDarkMode, exportWithDarkMode,
scale = 1, scale = 1,
shouldAddWatermark,
metadata = "", metadata = "",
}: { }: {
exportBackground: boolean; exportBackground: boolean;
@ -102,17 +85,10 @@ export const exportToSvg = (
scale?: number; scale?: number;
viewBackgroundColor: string; viewBackgroundColor: string;
exportWithDarkMode?: boolean; exportWithDarkMode?: boolean;
shouldAddWatermark: boolean;
metadata?: string; metadata?: string;
}, },
): SVGSVGElement => { ): SVGSVGElement => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark); const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);
const [minX, minY, width, height] = getCanvasSize(
sceneElements,
exportPadding,
shouldAddWatermark,
);
// initialze SVG root // initialze SVG root
const svgRoot = document.createElementNS(SVG_NS, "svg"); const svgRoot = document.createElementNS(SVG_NS, "svg");
@ -154,7 +130,7 @@ export const exportToSvg = (
} }
const rsvg = rough.svg(svgRoot); const rsvg = rough.svg(svgRoot);
renderSceneToSvg(sceneElements, rsvg, svgRoot, { renderSceneToSvg(elements, rsvg, svgRoot, {
offsetX: -minX + exportPadding, offsetX: -minX + exportPadding,
offsetY: -minY + exportPadding, offsetY: -minY + exportPadding,
}); });
@ -162,52 +138,14 @@ export const exportToSvg = (
return svgRoot; return svgRoot;
}; };
const getElementsAndWatermark = (
elements: readonly NonDeletedExcalidrawElement[],
shouldAddWatermark: boolean,
): readonly NonDeletedExcalidrawElement[] => {
let _elements = [...elements];
if (shouldAddWatermark) {
const [, , maxX, maxY] = getCommonBounds(elements);
_elements = [..._elements, getWatermarkElement(maxX, maxY)];
}
return _elements;
};
const getWatermarkElement = (maxX: number, maxY: number) => {
return newTextElement({
text: t("labels.madeWithExcalidraw"),
fontSize: WATERMARK_HEIGHT,
fontFamily: DEFAULT_FONT_FAMILY,
textAlign: "right",
verticalAlign: DEFAULT_VERTICAL_ALIGN,
x: maxX,
y: maxY + WATERMARK_HEIGHT,
strokeColor: oc.gray[5],
backgroundColor: "transparent",
fillStyle: "hachure",
strokeWidth: 1,
strokeStyle: "solid",
roughness: 1,
opacity: 100,
strokeSharpness: "sharp",
});
};
// calculate smallest area to fit the contents in // calculate smallest area to fit the contents in
const getCanvasSize = ( const getCanvasSize = (
elements: readonly NonDeletedExcalidrawElement[], elements: readonly NonDeletedExcalidrawElement[],
exportPadding: number, exportPadding: number,
shouldAddWatermark: boolean,
): [number, number, number, number] => { ): [number, number, number, number] => {
const [minX, minY, maxX, maxY] = getCommonBounds(elements); const [minX, minY, maxX, maxY] = getCommonBounds(elements);
const width = distance(minX, maxX) + exportPadding * 2; const width = distance(minX, maxX) + exportPadding * 2;
const height = const height = distance(minY, maxY) + exportPadding + exportPadding;
distance(minY, maxY) +
exportPadding +
(shouldAddWatermark ? 0 : exportPadding);
return [minX, minY, width, height]; return [minX, minY, width, height];
}; };
@ -215,15 +153,11 @@ const getCanvasSize = (
export const getExportSize = ( export const getExportSize = (
elements: readonly NonDeletedExcalidrawElement[], elements: readonly NonDeletedExcalidrawElement[],
exportPadding: number, exportPadding: number,
shouldAddWatermark: boolean,
scale: number, scale: number,
): [number, number] => { ): [number, number] => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark);
const [, , width, height] = getCanvasSize( const [, , width, height] = getCanvasSize(
sceneElements, elements,
exportPadding, exportPadding,
shouldAddWatermark,
).map((dimension) => Math.trunc(dimension * scale)); ).map((dimension) => Math.trunc(dimension * scale));
return [width, height]; return [width, height];

View File

@ -57,7 +57,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -221,7 +220,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -529,7 +527,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -837,7 +834,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -999,7 +995,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -1197,7 +1192,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -1452,7 +1446,6 @@ Object {
"id3": true, "id3": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -1770,7 +1763,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -2491,7 +2483,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -2799,7 +2790,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3111,7 +3101,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3492,7 +3481,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3749,7 +3737,6 @@ Object {
"id4": true, "id4": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -4066,7 +4053,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -4168,7 +4154,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,

View File

@ -68,7 +68,6 @@ Object {
"id5": true, "id5": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -536,7 +535,6 @@ Object {
"id5": true, "id5": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -986,7 +984,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -1764,7 +1761,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -1973,7 +1969,6 @@ Object {
"id5": true, "id5": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -2426,7 +2421,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -2676,7 +2670,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -2843,7 +2836,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3283,7 +3275,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3522,7 +3513,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3728,7 +3718,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -3970,7 +3959,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -4223,7 +4211,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -4626,7 +4613,6 @@ Object {
"x": 500, "x": 500,
"y": 500, "y": 500,
}, },
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -4899,7 +4885,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -5192,7 +5177,6 @@ Object {
"x": 110, "x": 110,
"y": 110, "y": 110,
}, },
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -5378,7 +5362,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -5542,7 +5525,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -6002,7 +5984,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -6313,7 +6294,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -8364,7 +8344,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -8727,7 +8706,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -8980,7 +8958,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -9234,7 +9211,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -9544,7 +9520,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -9708,7 +9683,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -9872,7 +9846,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10036,7 +10009,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10230,7 +10202,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10424,7 +10395,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10630,7 +10600,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10824,7 +10793,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -10988,7 +10956,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -11152,7 +11119,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -11346,7 +11312,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -11510,7 +11475,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -11727,7 +11691,6 @@ Object {
"id4": true, "id4": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -12436,7 +12399,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -12685,7 +12647,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": true, "shouldCacheIgnoreZoom": true,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -12785,7 +12746,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -12890,7 +12850,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -13063,7 +13022,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -13378,7 +13336,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -13589,7 +13546,6 @@ Object {
"id10": true, "id10": true,
}, },
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -14397,7 +14353,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -14501,7 +14456,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -15279,7 +15233,6 @@ Object {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -15682,7 +15635,6 @@ Object {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -15931,7 +15883,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": true, "shouldCacheIgnoreZoom": true,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -16033,7 +15984,6 @@ Object {
}, },
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -16529,7 +16479,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,
@ -16629,7 +16578,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,

View File

@ -54,7 +54,6 @@ Object {
"selectedElementIds": Object {}, "selectedElementIds": Object {},
"selectedGroupIds": Object {}, "selectedGroupIds": Object {},
"selectionElement": null, "selectionElement": null,
"shouldAddWatermark": false,
"shouldCacheIgnoreZoom": false, "shouldCacheIgnoreZoom": false,
"showHelpDialog": false, "showHelpDialog": false,
"showStats": false, "showStats": false,

View File

@ -13,7 +13,6 @@ describe("exportToSvg", () => {
const DEFAULT_OPTIONS = { const DEFAULT_OPTIONS = {
exportBackground: false, exportBackground: false,
viewBackgroundColor: "#ffffff", viewBackgroundColor: "#ffffff",
shouldAddWatermark: false,
}; };
it("with default arguments", () => { it("with default arguments", () => {
@ -37,17 +36,6 @@ describe("exportToSvg", () => {
); );
}); });
it("with watermark", () => {
const svgElement = exportUtils.exportToSvg(ELEMENTS, {
...DEFAULT_OPTIONS,
shouldAddWatermark: true,
});
expect(svgElement.querySelector("text")?.textContent).toMatchInlineSnapshot(
`"Made with Excalidraw"`,
);
});
it("with dark mode", () => { it("with dark mode", () => {
const svgElement = exportUtils.exportToSvg(ELEMENTS, { const svgElement = exportUtils.exportToSvg(ELEMENTS, {
...DEFAULT_OPTIONS, ...DEFAULT_OPTIONS,

View File

@ -58,7 +58,6 @@ export type AppState = {
exportBackground: boolean; exportBackground: boolean;
exportEmbedScene: boolean; exportEmbedScene: boolean;
exportWithDarkMode: boolean; exportWithDarkMode: boolean;
shouldAddWatermark: boolean;
currentItemStrokeColor: string; currentItemStrokeColor: string;
currentItemBackgroundColor: string; currentItemBackgroundColor: string;
currentItemFillStyle: ExcalidrawElement["fillStyle"]; currentItemFillStyle: ExcalidrawElement["fillStyle"];