This commit is contained in:
Cat /dev/Nulo 2023-08-29 11:05:34 -03:00
parent 559f107b14
commit e3b2edd214
13 changed files with 37 additions and 22 deletions

View file

@ -8,7 +8,8 @@
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"upload": "scp -CrP993 dist/* root@nulo.in:/var/www/beta.schreiben.nulo.ar/"
"upload": "scp -CrP993 dist/* root@nulo.in:/var/www/beta.schreiben.nulo.ar/",
"format": "prettier --write src/"
},
"devDependencies": {
"@poppanator/sveltekit-svg": "^2.1.2",

View file

@ -1,3 +1,3 @@
module.exports = {
plugins: ["prettier-plugin-tailwindcss", "prettier-plugin-svelte"],
plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
};

View file

@ -3,7 +3,22 @@
@tailwind utilities;
:root {
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-family:
Inter,
ui-sans-serif,
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
"Helvetica Neue",
Arial,
"Noto Sans",
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji";
font-weight: 400;
font-synthesis: none;

View file

@ -55,4 +55,3 @@
content: "Descripción: ";
color: #666;
}

View file

@ -26,7 +26,7 @@ import { schema } from "./schema";
const backspace = chainCommands(
deleteSelection,
joinBackward,
selectNodeBackward
selectNodeBackward,
);
const del = chainCommands(deleteSelection, joinForward, selectNodeForward);
@ -37,7 +37,7 @@ const pcBaseKeymap = {
liftEmptyBlock,
// XXX: hack
splitListItem(schema.nodes.list_item as any),
splitBlock
splitBlock,
),
"Mod-Enter": chainCommands(exitCode, splitBlock),
Backspace: backspace,

View file

@ -11,14 +11,14 @@ import type { EditorView } from "prosemirror-view";
export type Command = (
state: EditorState,
dispatch?: EditorView["dispatch"]
dispatch?: EditorView["dispatch"],
) => boolean;
// A lot of this is from https://github.com/ueberdosis/tiptap/blob/main/packages/tiptap-commands
export function getMarkRange(
$pos: ResolvedPos | null = null,
type: MarkType | null = null
type: MarkType | null = null,
) {
if (!$pos || !type) {
return false;
@ -122,14 +122,14 @@ export function toggleNode(
attrs: any,
/// es el tipo que se setea si ya es el type querido; probablemente querés
/// que sea el type de párrafo
alternateType: NodeType
alternateType: NodeType,
): Command {
return chainCommands(setBlockType(type, attrs), setBlockType(alternateType));
}
export function commandListener(
view: EditorView,
command: Command
command: Command,
): (event: Event) => void {
return (event) => {
event.preventDefault();
@ -139,7 +139,7 @@ export function commandListener(
export default function findParentNodeClosestToPos(
$pos: ResolvedPos,
predicate: (node: ProsemirrorNode) => boolean
predicate: (node: ProsemirrorNode) => boolean,
) {
for (let i = $pos.depth; i > 0; i -= 1) {
const node = $pos.node(i);
@ -158,7 +158,7 @@ export default function findParentNodeClosestToPos(
export function nodeIsActiveFn(
type: NodeType,
attrs?: any,
checkParents: boolean = false
checkParents: boolean = false,
): (state: EditorState) => boolean {
return (state) => {
let { $from, to } = state.selection;
@ -196,7 +196,7 @@ export interface MarkMatch {
export function getFirstMarkInSelection(
state: EditorState,
type: MarkType
type: MarkType,
): MarkMatch | null {
const { to, from } = state.selection;

View file

@ -315,7 +315,7 @@ export const schema = new Schema({
if (
href &&
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
href
href,
)
) {
return {

View file

@ -9,7 +9,7 @@ interface Props {
export function h(
tagName: string,
props: Props,
children: (Node | string | undefined)[]
children: (Node | string | undefined)[],
): HTMLElement {
const el = document.createElement(tagName);
if (props.class) {

View file

@ -25,7 +25,7 @@ export function generateNewWorld(): WorldIdentifier {
let worldYCache: { [key: string]: WorldY } = {};
const credsReq = fetch(
"https://nulo.metered.live/api/v1/turn/credentials?apiKey=205de2914a8564e2efa19a7d7f299a95e574"
"https://nulo.metered.live/api/v1/turn/credentials?apiKey=205de2914a8564e2efa19a7d7f299a95e574",
).then((res) => res.json());
export function getWorldY(world: WorldIdentifier): WorldY {

View file

@ -24,6 +24,6 @@ export function lastUpdated(ydoc: Doc) {
}
return map;
},
() => observers.forEach(({ y, observer }) => y.unobserveDeep(observer))
() => observers.forEach(({ y, observer }) => y.unobserveDeep(observer)),
)(ydoc);
}

View file

@ -6,9 +6,9 @@ export function makeYdocStore<T>(
update: Uint8Array | null,
origin: any,
ydoc: Doc,
tr: Transaction | null
tr: Transaction | null,
) => T,
unhandler?: () => void
unhandler?: () => void,
) {
return (ydoc: Doc): Readable<T> => {
// thanks https://github.com/relm-us/svelt-yjs/blob/main/src/types/array.ts
@ -18,7 +18,7 @@ export function makeYdocStore<T>(
update: Uint8Array | null,
origin: any,
ydoc: Doc,
tr: Transaction | null
tr: Transaction | null,
) {
run(handler(update, origin, ydoc, tr));
}

View file

@ -27,6 +27,6 @@ export function titleStore(ydoc, id) {
return title;
},
() => observer && y?.unobserveDeep(observer)
() => observer && y?.unobserveDeep(observer),
)(ydoc);
}

View file

@ -14,7 +14,7 @@ export function loadWorlds(): Promise<WorldIdentifier[]> {
}
export async function writeWorlds(
callback: (worlds: WorldIdentifier[]) => WorldIdentifier[]
callback: (worlds: WorldIdentifier[]) => WorldIdentifier[],
): Promise<WorldIdentifier[]> {
const oldWorlds = await loadWorlds();
const newWorlds = callback(oldWorlds);