Skip to content

Commit

Permalink
Merge pull request #30 from nextcloud-gmbh/feat/fonts
Browse files Browse the repository at this point in the history
Properly load fonts
  • Loading branch information
juliusknorr authored Jun 12, 2024
2 parents 84c7ec6 + dd3bd95 commit b7e9c77
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 21 deletions.
69 changes: 56 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"stylelint-config-css-modules": "^4.4.0",
"typescript": "^5.4.5",
"typescript-plugin-css-modules": "^5.1.0",
"vite": "^5.2.11"
"vite": "^5.2.11",
"vite-plugin-static-copy": "^1.0.5"
},
"prettier": {
"useTabs": true,
Expand Down
8 changes: 6 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { StrictMode } from 'react'

import { linkTo } from '@nextcloud/router'
import { StrictMode, lazy } from 'react'
import { createRoot } from 'react-dom'
import App from './App'

import './viewer.css'

window.EXCALIDRAW_ASSET_PATH = linkTo('whiteboard', 'dist/')

const Component = {
name: 'Whiteboard',
render(createElement: (arg0: string, arg1: { attrs: { id: string } }, arg2: string) => any) {
const App = React.lazy(() => import('./App'))
this.$emit('update:loaded', true)
const randomId = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
this.$nextTick(() => {
Expand Down
22 changes: 17 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

import { createAppConfig } from '@nextcloud/vite-config'
import react from '@vitejs/plugin-react'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { defineConfig } from 'vite'

const AppConfig = createAppConfig({
main: 'src/main.tsx',
}, {
plugins: [react({
jsxRuntime: 'classic',
})],
config: {
config: defineConfig({
css: {
modules: {
localsConvention: 'camelCase',
Expand All @@ -24,7 +23,20 @@ const AppConfig = createAppConfig({
esbuild: {
jsxInject: 'import React from \'react\'',
},
},
plugins: [
react({
jsxRuntime: 'classic',
}),
viteStaticCopy({
targets: [
{
src: './node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/*',
dest: './dist/excalidraw-assets',
},
],
}),
],
}),
})

export default AppConfig

0 comments on commit b7e9c77

Please sign in to comment.