mirror of https://github.com/msgbyte/tailchat
feat: init excalidraw plugin
parent
ae33aa3571
commit
6c7fb3e2ba
@ -0,0 +1,14 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
externalDeps: [
|
||||
'react',
|
||||
'react-router',
|
||||
'axios',
|
||||
'styled-components',
|
||||
'zustand',
|
||||
'zustand/middleware/immer',
|
||||
],
|
||||
pluginRoot: path.resolve(__dirname, './web'),
|
||||
outDir: path.resolve(__dirname, '../../public'),
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
import { db } from 'tailchat-server-sdk';
|
||||
const { getModelForClass, prop, modelOptions, TimeStamps } = db;
|
||||
|
||||
@modelOptions({
|
||||
options: {
|
||||
customName: 'p_excalidraw',
|
||||
},
|
||||
})
|
||||
export class Excalidraw extends TimeStamps implements db.Base {
|
||||
_id: db.Types.ObjectId;
|
||||
id: string;
|
||||
|
||||
@prop()
|
||||
userId: string;
|
||||
|
||||
@prop()
|
||||
dataState: Record<string, any>;
|
||||
}
|
||||
|
||||
export type ExcalidrawDocument = db.DocumentType<Excalidraw>;
|
||||
|
||||
const model = getModelForClass(Excalidraw);
|
||||
|
||||
export type ExcalidrawModel = typeof model;
|
||||
|
||||
export default model;
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "tailchat-plugin-excalidraw",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"author": "moonrailgun",
|
||||
"description": "Add excalidraw support in Tailchat",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:web": "ministar buildPlugin all",
|
||||
"build:web:watch": "ministar watchPlugin all"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "18.0.20",
|
||||
"mini-star": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"tailchat-server-sdk": "*"
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
import { TcService, TcDbService } from 'tailchat-server-sdk';
|
||||
import type { ExcalidrawDocument, ExcalidrawModel } from '../models/excalidraw';
|
||||
|
||||
/**
|
||||
* Excalidraw
|
||||
*
|
||||
* Add excalidraw support in Tailchat
|
||||
*/
|
||||
interface ExcalidrawService
|
||||
extends TcService,
|
||||
TcDbService<ExcalidrawDocument, ExcalidrawModel> {}
|
||||
class ExcalidrawService extends TcService {
|
||||
get serviceName() {
|
||||
return 'plugin:com.msgbyte.excalidraw';
|
||||
}
|
||||
|
||||
onInit() {
|
||||
this.registerLocalDb(require('../models/excalidraw').default);
|
||||
}
|
||||
}
|
||||
|
||||
export default ExcalidrawService;
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"label": "Excalidraw",
|
||||
"name": "com.msgbyte.excalidraw",
|
||||
"url": "{BACKEND}/plugins/com.msgbyte.excalidraw/index.js",
|
||||
"version": "0.0.0",
|
||||
"author": "moonrailgun",
|
||||
"description": "Add excalidraw support in Tailchat",
|
||||
"requireRestart": true
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@plugins/com.msgbyte.excalidraw",
|
||||
"main": "src/index.tsx",
|
||||
"version": "0.0.0",
|
||||
"description": "Add excalidraw support in Tailchat",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"sync:declaration": "tailchat declaration github"
|
||||
},
|
||||
"dependencies": {
|
||||
"@excalidraw/excalidraw": "^0.15.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"react": "18.2.0",
|
||||
"styled-components": "^5.3.6"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { Excalidraw } from '@excalidraw/excalidraw';
|
||||
|
||||
export const ExcalidrawRender: React.FC = React.memo(() => {
|
||||
return (
|
||||
<div style={{ height: '100%', width: '100%' }}>
|
||||
<Excalidraw initialData={{ elements: [] }} />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
ExcalidrawRender.displayName = 'ExcalidrawRender';
|
@ -0,0 +1 @@
|
||||
console.log('Plugin Excalidraw is loaded');
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react",
|
||||
"importsNotUsedAsValues": "error"
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
declare module '@capital/common';
|
||||
declare module '@capital/component';
|
Loading…
Reference in New Issue