diff --git a/public/index.html b/public/index.html index 28b4d043..490775f2 100644 --- a/public/index.html +++ b/public/index.html @@ -86,7 +86,9 @@ /> - + <% if (process.env.REACT_APP_GOOGLE_ANALYTICS_ID) { %> , document.getElementById("root")); diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md index 7fe4ffc3..ae652143 100644 --- a/src/packages/excalidraw/CHANGELOG.md +++ b/src/packages/excalidraw/CHANGELOG.md @@ -12,20 +12,34 @@ 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] +## 0.4.0 ## Excalidraw API ### Features +- Expose `window.EXCALIDRAW_ASSET_PATH` which host can use to load assets from a different URL. By default it will be loaded from `https://unpkg.com/@excalidraw/excalidraw{currentVersion}/dist/`. + + Also now the assets will have a hash in filename so cache bursting can easily happen with version bump. + - Add support for `scrollToCenter` in [initialData](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L18) so host can control whether to scroll to center on mount [#3070](https://github.com/excalidraw/excalidraw/pull/3070). -- Export [`restore`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L182), [`restoreAppState`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L144) and [`restoreElements`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L128) to host +- Export [`restore`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L182), [`restoreAppState`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L144) and [`restoreElements`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L128) to host [#3049](https://github.com/excalidraw/excalidraw/pull/3049) ### Fixes - Show user state only when [userState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L35) is passed on remote pointers during collaboration [#3050](https://github.com/excalidraw/excalidraw/pull/3050) +## Excalidraw Library + +### Features + +- Adjust line-confirm-threshold based on zoom [#2884](https://github.com/excalidraw/excalidraw/pull/2884) + +### Fixes + +- Hide scrollbars on mobile [#3044](https://github.com/excalidraw/excalidraw/pull/3044) + ## 0.3.1 ## Excalidraw API diff --git a/src/packages/excalidraw/README.md b/src/packages/excalidraw/README.md index d72c61b5..fbca470a 100644 --- a/src/packages/excalidraw/README.md +++ b/src/packages/excalidraw/README.md @@ -20,13 +20,9 @@ After installation you will see a folder `excalidraw-assets` in `dist` directory Move the folder `excalidraw-assets` to the path where your assets are served. -By default it will try to load the files from `{rootUrl}/excalidraw-assets/` +By default it will try to load the files from `https://unpkg.com/@excalidraw/excalidraw/{currentVersion}/dist/` -With **Webpack**, if you want to load the files from different path you can use
`__webpack_public_path__`. - -With **create-react-app**, the assets can be served from `public/static/js/excalidraw-assets`since CRA tries to load the assets from `{rootUrl}/static/js` path by default. - -You can update the value of `PUBLIC_URL` if you want to serve it from a different URL. +If you want to load assets from a different path you can set a variable `window.EXCALIDRAW_ASSET_PATH` to the url from where you want to load the assets. ### Demo diff --git a/src/packages/excalidraw/index.tsx b/src/packages/excalidraw/index.tsx index 222ac966..773b9f47 100644 --- a/src/packages/excalidraw/index.tsx +++ b/src/packages/excalidraw/index.tsx @@ -1,4 +1,5 @@ import React, { useEffect, forwardRef } from "react"; +import "./publicPath"; import { InitializeApp } from "../../components/InitializeApp"; import App from "../../components/App"; diff --git a/src/packages/excalidraw/package.json b/src/packages/excalidraw/package.json index 1ff35c49..99bdd3bb 100644 --- a/src/packages/excalidraw/package.json +++ b/src/packages/excalidraw/package.json @@ -1,6 +1,6 @@ { "name": "@excalidraw/excalidraw", - "version": "0.3.1", + "version": "0.4.0", "main": "dist/excalidraw.min.js", "files": [ "dist/*" diff --git a/src/packages/excalidraw/publicPath.js b/src/packages/excalidraw/publicPath.js new file mode 100644 index 00000000..93660ee6 --- /dev/null +++ b/src/packages/excalidraw/publicPath.js @@ -0,0 +1,9 @@ +import { ENV } from "../../constants"; +import pkg from "./package.json"; +if (process.env.NODE_ENV !== ENV.TEST) { + /* eslint-disable */ + /* global __webpack_public_path__:writable */ + __webpack_public_path__ = + window.EXCALIDRAW_ASSET_PATH || + `https://unpkg.com/${pkg.name}@${pkg.version}/dist/`; +} diff --git a/src/packages/excalidraw/webpack.prod.config.js b/src/packages/excalidraw/webpack.prod.config.js index d15ec159..b1e808cc 100644 --- a/src/packages/excalidraw/webpack.prod.config.js +++ b/src/packages/excalidraw/webpack.prod.config.js @@ -13,7 +13,8 @@ module.exports = { library: "Excalidraw", libraryTarget: "umd", filename: "[name].js", - chunkFilename: "excalidraw-assets/[name].js", + chunkFilename: "excalidraw-assets/[name]-[contenthash].js", + publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"],