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,
exportEmbedScene: appState.exportEmbedScene,
gridSize: appState.gridSize,
shouldAddWatermark: appState.shouldAddWatermark,
showStats: appState.showStats,
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({
name: "saveScene",
perform: async (elements, appState, value) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,7 +69,6 @@ const canvas = exportToCanvas(
{
exportBackground: true,
viewBackgroundColor: "#ffffff",
shouldAddWatermark: false,
scale: 1,
},
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.
-->
## 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)
## 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 |
| 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 |

View File

@ -829,5 +829,4 @@ This function returns a svg with the exported elements.
| --- | --- | --- | --- |
| exportBackground | boolean | true | Indicates whether background should be exported |
| 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 |

View File

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

View File

@ -1,21 +1,13 @@
import rough from "roughjs/bin/rough";
import oc from "open-color";
import { newTextElement } from "../element";
import { NonDeletedExcalidrawElement } from "../element/types";
import { getCommonBounds } from "../element/bounds";
import { renderScene, renderSceneToSvg } from "../renderer/renderScene";
import { distance, SVG_NS } from "../utils";
import { AppState } from "../types";
import { t } from "../i18n";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_VERTICAL_ALIGN,
THEME_FILTER,
} from "../constants";
import { THEME_FILTER } from "../constants";
import { getDefaultAppState } from "../appState";
export const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
const WATERMARK_HEIGHT = 16;
export const exportToCanvas = (
elements: readonly NonDeletedExcalidrawElement[],
@ -25,13 +17,11 @@ export const exportToCanvas = (
exportPadding = 10,
viewBackgroundColor,
scale = 1,
shouldAddWatermark,
}: {
exportBackground: boolean;
exportPadding?: number;
scale?: number;
viewBackgroundColor: string;
shouldAddWatermark: boolean;
},
createCanvas: (
width: number,
@ -43,13 +33,7 @@ export const exportToCanvas = (
return { canvas: tempCanvas, scale };
},
) => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark);
const [minX, minY, width, height] = getCanvasSize(
sceneElements,
exportPadding,
shouldAddWatermark,
);
const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);
const { canvas: tempCanvas, scale: newScale = scale } = createCanvas(
width,
@ -57,7 +41,7 @@ export const exportToCanvas = (
);
renderScene(
sceneElements,
elements,
appState,
null,
newScale,
@ -94,7 +78,6 @@ export const exportToSvg = (
viewBackgroundColor,
exportWithDarkMode,
scale = 1,
shouldAddWatermark,
metadata = "",
}: {
exportBackground: boolean;
@ -102,17 +85,10 @@ export const exportToSvg = (
scale?: number;
viewBackgroundColor: string;
exportWithDarkMode?: boolean;
shouldAddWatermark: boolean;
metadata?: string;
},
): SVGSVGElement => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark);
const [minX, minY, width, height] = getCanvasSize(
sceneElements,
exportPadding,
shouldAddWatermark,
);
const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);
// initialze SVG root
const svgRoot = document.createElementNS(SVG_NS, "svg");
@ -154,7 +130,7 @@ export const exportToSvg = (
}
const rsvg = rough.svg(svgRoot);
renderSceneToSvg(sceneElements, rsvg, svgRoot, {
renderSceneToSvg(elements, rsvg, svgRoot, {
offsetX: -minX + exportPadding,
offsetY: -minY + exportPadding,
});
@ -162,52 +138,14 @@ export const exportToSvg = (
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
const getCanvasSize = (
elements: readonly NonDeletedExcalidrawElement[],
exportPadding: number,
shouldAddWatermark: boolean,
): [number, number, number, number] => {
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
const width = distance(minX, maxX) + exportPadding * 2;
const height =
distance(minY, maxY) +
exportPadding +
(shouldAddWatermark ? 0 : exportPadding);
const height = distance(minY, maxY) + exportPadding + exportPadding;
return [minX, minY, width, height];
};
@ -215,15 +153,11 @@ const getCanvasSize = (
export const getExportSize = (
elements: readonly NonDeletedExcalidrawElement[],
exportPadding: number,
shouldAddWatermark: boolean,
scale: number,
): [number, number] => {
const sceneElements = getElementsAndWatermark(elements, shouldAddWatermark);
const [, , width, height] = getCanvasSize(
sceneElements,
elements,
exportPadding,
shouldAddWatermark,
).map((dimension) => Math.trunc(dimension * scale));
return [width, height];

View File

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

View File

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

View File

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

View File

@ -13,7 +13,6 @@ describe("exportToSvg", () => {
const DEFAULT_OPTIONS = {
exportBackground: false,
viewBackgroundColor: "#ffffff",
shouldAddWatermark: false,
};
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", () => {
const svgElement = exportUtils.exportToSvg(ELEMENTS, {
...DEFAULT_OPTIONS,

View File

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