fixchunks
This commit is contained in:
parent
c88482f36a
commit
65d6c177ae
|
@ -44,6 +44,9 @@ const astroConfig: AstroUserConfig = {
|
||||||
manualChunks(id) {
|
manualChunks(id) {
|
||||||
if (id.includes('node_modules')) {
|
if (id.includes('node_modules')) {
|
||||||
let chunkid = 'vendor'
|
let chunkid = 'vendor'
|
||||||
|
if (id.includes('solid')) {
|
||||||
|
chunkid = 'solid'
|
||||||
|
}
|
||||||
if (id.includes('acorn')) {
|
if (id.includes('acorn')) {
|
||||||
chunkid = 'acorn'
|
chunkid = 'acorn'
|
||||||
}
|
}
|
||||||
|
@ -53,18 +56,12 @@ const astroConfig: AstroUserConfig = {
|
||||||
if (id.includes('prosemirror')) {
|
if (id.includes('prosemirror')) {
|
||||||
chunkid = 'prosemirror'
|
chunkid = 'prosemirror'
|
||||||
}
|
}
|
||||||
if (id.includes('markdown')) {
|
if (id.includes('markdown') || id.includes('mdurl')) {
|
||||||
chunkid = 'markdown'
|
chunkid = 'markdown'
|
||||||
}
|
}
|
||||||
if (id.includes('swiper')) {
|
if (id.includes('swiper')) {
|
||||||
chunkid = 'swiper'
|
chunkid = 'swiper'
|
||||||
}
|
}
|
||||||
if (id.includes('remark') || id.includes('rehype') || id.includes('micromark')) {
|
|
||||||
chunkid = 'remark'
|
|
||||||
}
|
|
||||||
if (id.includes('parse5')) {
|
|
||||||
chunkid = 'parse5'
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
id.includes('yjs') ||
|
id.includes('yjs') ||
|
||||||
id.includes('y-prosemirror') ||
|
id.includes('y-prosemirror') ||
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
@import './Button';
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding-top: 1em;
|
padding-top: 1em;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Switch, Match } from 'solid-js'
|
import { Switch, Match, createMemo } from 'solid-js'
|
||||||
import { useState } from './prosemirror/context'
|
import { ErrorObject, useState } from './store'
|
||||||
import './Button.scss'
|
|
||||||
|
|
||||||
const InvalidState = (props: { title: string }) => {
|
const InvalidState = (props: { title: string }) => {
|
||||||
const [store, ctrl] = useState()
|
const [store, ctrl] = useState()
|
||||||
|
@ -16,7 +15,7 @@ const InvalidState = (props: { title: string }) => {
|
||||||
you can copy important notes from below, clean the state and paste it again.
|
you can copy important notes from below, clean the state and paste it again.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
<code>{JSON.stringify(store.error?.props)}</code>
|
<code>{JSON.stringify(store.error)}</code>
|
||||||
</pre>
|
</pre>
|
||||||
<button class="primary" onClick={onClick}>
|
<button class="primary" onClick={onClick}>
|
||||||
Clean
|
Clean
|
||||||
|
@ -29,12 +28,7 @@ const InvalidState = (props: { title: string }) => {
|
||||||
const Other = () => {
|
const Other = () => {
|
||||||
const [store, ctrl] = useState()
|
const [store, ctrl] = useState()
|
||||||
const onClick = () => ctrl.discard()
|
const onClick = () => ctrl.discard()
|
||||||
|
const getMessage = createMemo<ErrorObject['message']>(() => store.error.message)
|
||||||
const getMessage = () => {
|
|
||||||
const err = (store.error?.props as any).error
|
|
||||||
|
|
||||||
return typeof err === 'string' ? err : err.message
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="error" data-tauri-drag-region="true">
|
<div class="error" data-tauri-drag-region="true">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import './Editor.scss'
|
||||||
import type { EditorView } from 'prosemirror-view'
|
import type { EditorView } from 'prosemirror-view'
|
||||||
import type { EditorState } from 'prosemirror-state'
|
import type { EditorState } from 'prosemirror-state'
|
||||||
import { useState } from './prosemirror/context'
|
import { useState } from './store'
|
||||||
import { ProseMirror } from './prosemirror'
|
import { ProseMirror } from './prosemirror'
|
||||||
import './Editor.scss'
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [store, ctrl] = useState()
|
const [store, ctrl] = useState()
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
import { createContext, useContext } from 'solid-js'
|
|
||||||
import type { Store } from 'solid-js/store'
|
|
||||||
import type { XmlFragment } from 'yjs'
|
|
||||||
import type { WebrtcProvider } from 'y-webrtc'
|
|
||||||
import type { ProseMirrorExtension, ProseMirrorState } from './state'
|
|
||||||
import type { Reaction } from '../../../graphql/types.gen'
|
|
||||||
|
|
||||||
export const isMac = true
|
|
||||||
|
|
||||||
export const mod = isMac ? 'Cmd' : 'Ctrl'
|
|
||||||
export const alt = isMac ? 'Cmd' : 'Alt'
|
|
||||||
|
|
||||||
export interface Args {
|
|
||||||
cwd?: string
|
|
||||||
file?: string
|
|
||||||
room?: string
|
|
||||||
text?: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PrettierConfig {
|
|
||||||
printWidth: number
|
|
||||||
tabWidth: number
|
|
||||||
useTabs: boolean
|
|
||||||
semi: boolean
|
|
||||||
singleQuote: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Config {
|
|
||||||
theme: string
|
|
||||||
// codeTheme: string;
|
|
||||||
font: string
|
|
||||||
fontSize: number
|
|
||||||
contentWidth: number
|
|
||||||
alwaysOnTop: boolean
|
|
||||||
// typewriterMode: boolean;
|
|
||||||
prettier: PrettierConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ErrorObject {
|
|
||||||
id: string
|
|
||||||
props?: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface YOptions {
|
|
||||||
type: XmlFragment
|
|
||||||
provider: WebrtcProvider
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Collab {
|
|
||||||
started?: boolean
|
|
||||||
error?: boolean
|
|
||||||
room?: string
|
|
||||||
y?: YOptions
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LoadingType = 'loading' | 'initialized'
|
|
||||||
|
|
||||||
export interface File {
|
|
||||||
text?: { [key: string]: any }
|
|
||||||
lastModified?: string
|
|
||||||
path?: string
|
|
||||||
markdown?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface State {
|
|
||||||
text?: ProseMirrorState
|
|
||||||
editorView?: any
|
|
||||||
extensions?: ProseMirrorExtension[]
|
|
||||||
markdown?: boolean
|
|
||||||
lastModified?: Date
|
|
||||||
files: File[]
|
|
||||||
config: Config
|
|
||||||
error?: ErrorObject
|
|
||||||
loading: LoadingType
|
|
||||||
fullscreen: boolean
|
|
||||||
collab?: Collab
|
|
||||||
path?: string
|
|
||||||
args?: Args
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ServiceError extends Error {
|
|
||||||
public errorObject: ErrorObject
|
|
||||||
constructor(id: string, props: unknown) {
|
|
||||||
super(id)
|
|
||||||
this.errorObject = { id, props }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const DEFAULT_CONFIG = {
|
|
||||||
theme: '',
|
|
||||||
// codeTheme: 'material-light',
|
|
||||||
font: 'muller',
|
|
||||||
fontSize: 24,
|
|
||||||
contentWidth: 800,
|
|
||||||
alwaysOnTop: isMac,
|
|
||||||
// typewriterMode: true,
|
|
||||||
prettier: {
|
|
||||||
printWidth: 80,
|
|
||||||
tabWidth: 2,
|
|
||||||
useTabs: false,
|
|
||||||
semi: false,
|
|
||||||
singleQuote: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const StateContext = createContext<[Store<State>, any]>([{} as Store<State>, undefined])
|
|
||||||
|
|
||||||
export const useState = () => useContext(StateContext)
|
|
||||||
|
|
||||||
export const newState = (props: Partial<State> = {}): State => ({
|
|
||||||
extensions: [],
|
|
||||||
files: [],
|
|
||||||
loading: 'loading',
|
|
||||||
fullscreen: false,
|
|
||||||
markdown: false,
|
|
||||||
config: DEFAULT_CONFIG,
|
|
||||||
...props
|
|
||||||
})
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ySyncPlugin, yCursorPlugin, yUndoPlugin } from 'y-prosemirror'
|
import { ySyncPlugin, yCursorPlugin, yUndoPlugin } from 'y-prosemirror'
|
||||||
import type { ProseMirrorExtension } from '../state'
|
import type { ProseMirrorExtension } from '../state'
|
||||||
import type { YOptions } from '../context'
|
import type { YOptions } from '../../store'
|
||||||
|
|
||||||
export const cursorBuilder = (user: any): HTMLElement => {
|
export const cursorBuilder = (user: any): HTMLElement => {
|
||||||
const cursor = document.createElement('span')
|
const cursor = document.createElement('span')
|
||||||
|
|
|
@ -15,7 +15,7 @@ import dragHandle from './extension/drag-handle'
|
||||||
import pasteMarkdown from './extension/paste-markdown'
|
import pasteMarkdown from './extension/paste-markdown'
|
||||||
import table from './extension/table'
|
import table from './extension/table'
|
||||||
import collab from './extension/collab'
|
import collab from './extension/collab'
|
||||||
import type { Config, YOptions } from './context'
|
import type { Config, YOptions } from '../store'
|
||||||
import selectionMenu from './extension/selection'
|
import selectionMenu from './extension/selection'
|
||||||
|
|
||||||
interface Opts {
|
interface Opts {
|
||||||
|
|
|
@ -3,7 +3,13 @@ import type { Store } from 'solid-js/store'
|
||||||
import type { XmlFragment } from 'yjs'
|
import type { XmlFragment } from 'yjs'
|
||||||
import type { WebrtcProvider } from 'y-webrtc'
|
import type { WebrtcProvider } from 'y-webrtc'
|
||||||
import type { ProseMirrorExtension, ProseMirrorState } from '../prosemirror/state'
|
import type { ProseMirrorExtension, ProseMirrorState } from '../prosemirror/state'
|
||||||
import { isMac } from '../prosemirror/context'
|
import type { Reaction } from '../../../graphql/types.gen'
|
||||||
|
import type { EditorView } from 'prosemirror-view'
|
||||||
|
|
||||||
|
export const isMac = true
|
||||||
|
|
||||||
|
export const mod = isMac ? 'Cmd' : 'Ctrl'
|
||||||
|
export const alt = isMac ? 'Cmd' : 'Alt'
|
||||||
|
|
||||||
export interface Args {
|
export interface Args {
|
||||||
cwd?: string
|
cwd?: string
|
||||||
|
@ -32,8 +38,9 @@ export interface Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ErrorObject {
|
export interface ErrorObject {
|
||||||
|
message: string
|
||||||
id: string
|
id: string
|
||||||
props?: unknown
|
props: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface YOptions {
|
export interface YOptions {
|
||||||
|
@ -59,7 +66,7 @@ export interface File {
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
text?: ProseMirrorState
|
text?: ProseMirrorState
|
||||||
editorView?: any
|
editorView?: EditorView
|
||||||
extensions?: ProseMirrorExtension[]
|
extensions?: ProseMirrorExtension[]
|
||||||
markdown?: boolean
|
markdown?: boolean
|
||||||
lastModified?: Date
|
lastModified?: Date
|
||||||
|
@ -77,22 +84,12 @@ export class ServiceError extends Error {
|
||||||
public errorObject: ErrorObject
|
public errorObject: ErrorObject
|
||||||
constructor(id: string, props: unknown) {
|
constructor(id: string, props: unknown) {
|
||||||
super(id)
|
super(id)
|
||||||
this.errorObject = { id, props }
|
this.errorObject = { id, props, message: '' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const StateContext = createContext<[Store<State>, any]>([{} as Store<State>, undefined])
|
const DEFAULT_CONFIG = {
|
||||||
|
theme: '',
|
||||||
export const useState = () => useContext(StateContext)
|
|
||||||
|
|
||||||
export const newState = (props: Partial<State> = {}): State => ({
|
|
||||||
extensions: [],
|
|
||||||
files: [],
|
|
||||||
loading: 'loading',
|
|
||||||
fullscreen: false,
|
|
||||||
markdown: false,
|
|
||||||
config: {
|
|
||||||
theme: 'light',
|
|
||||||
// codeTheme: 'material-light',
|
// codeTheme: 'material-light',
|
||||||
font: 'muller',
|
font: 'muller',
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
|
@ -106,6 +103,18 @@ export const newState = (props: Partial<State> = {}): State => ({
|
||||||
semi: false,
|
semi: false,
|
||||||
singleQuote: true
|
singleQuote: true
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
|
export const StateContext = createContext<[Store<State>, any]>([{} as Store<State>, undefined])
|
||||||
|
|
||||||
|
export const useState = () => useContext(StateContext)
|
||||||
|
|
||||||
|
export const newState = (props: Partial<State> = {}): State => ({
|
||||||
|
extensions: [],
|
||||||
|
files: [],
|
||||||
|
loading: 'loading',
|
||||||
|
fullscreen: false,
|
||||||
|
markdown: false,
|
||||||
|
config: DEFAULT_CONFIG,
|
||||||
...props
|
...props
|
||||||
})
|
})
|
||||||
|
|
|
@ -46,6 +46,7 @@ import { CreatePage } from './Pages/CreatePage'
|
||||||
// const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
// const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
||||||
// const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
// const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
||||||
// const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
// const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
||||||
|
// const CreatePage = lazy(() => import('./Pages/about/CreatePage'))
|
||||||
|
|
||||||
const log = getLogger('root')
|
const log = getLogger('root')
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { Show, onCleanup, createEffect, onError, onMount, untrack } from 'solid-js'
|
import { Show, onCleanup, createEffect, onError, onMount, untrack } from 'solid-js'
|
||||||
import { createMutable, unwrap } from 'solid-js/store'
|
import { createMutable, unwrap } from 'solid-js/store'
|
||||||
import { State, StateContext } from '../Editor/prosemirror/context'
|
import { State, StateContext, newState } from '../Editor/store'
|
||||||
import { createCtrl } from '../Editor/store/ctrl'
|
import { createCtrl } from '../Editor/store/ctrl'
|
||||||
import { Layout } from '../Editor/Layout'
|
import { Layout } from '../Editor/Layout'
|
||||||
import Editor from '../Editor'
|
import Editor from '../Editor'
|
||||||
import { Sidebar } from '../Editor/Sidebar'
|
import { Sidebar } from '../Editor/Sidebar'
|
||||||
import ErrorView from '../Editor/Error'
|
import ErrorView from '../Editor/Error'
|
||||||
import { newState } from '../Editor/store'
|
|
||||||
import { getLogger } from '../../utils/logger'
|
import { getLogger } from '../../utils/logger'
|
||||||
|
|
||||||
const log = getLogger('CreateView')
|
const log = getLogger('CreateView')
|
||||||
|
@ -15,7 +14,7 @@ export const CreateView = () => {
|
||||||
const [store, ctrl] = createCtrl(newState())
|
const [store, ctrl] = createCtrl(newState())
|
||||||
const mouseEnterCoords = createMutable({ x: 0, y: 0 })
|
const mouseEnterCoords = createMutable({ x: 0, y: 0 })
|
||||||
|
|
||||||
const onMouseEnter = (e: any) => {
|
const onMouseEnter = (e: MouseEvent) => {
|
||||||
mouseEnterCoords.x = e.pageX
|
mouseEnterCoords.x = e.pageX
|
||||||
mouseEnterCoords.y = e.pageY
|
mouseEnterCoords.y = e.pageY
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user