diff --git a/macos-editor/index.html b/macos-editor/index.html index f3fa27a..82b60fa 100644 --- a/macos-editor/index.html +++ b/macos-editor/index.html @@ -9,7 +9,6 @@
- diff --git a/macos-editor/main.js b/macos-editor/main.js index bfee486..efc7e35 100644 --- a/macos-editor/main.js +++ b/macos-editor/main.js @@ -18,7 +18,6 @@ function createNewFileWindow() { height: 600, title: `New File - ${packageJson.productName}`, webPreferences: { - preload: path.join(__dirname, 'preload.js'), nodeIntegration: true, contextIsolation: false } @@ -111,24 +110,7 @@ const menuTemplate = [ const appMenu = Menu.buildFromTemplate(menuTemplate); Menu.setApplicationMenu(appMenu); -function createSplashWindow() { - const splashWindow = new BrowserWindow({ - width: 400, - height: 300, - frame: false, - alwaysOnTop: true, - transparent: true, - webPreferences: { - nodeIntegration: true, - contextIsolation: false - } - }); - - splashWindow.loadFile('splash.html'); - return splashWindow; -} - -function createWindow() { +async function createWindow() { const mainWindow = new BrowserWindow({ width: 800, height: 600, @@ -136,26 +118,19 @@ function createWindow() { title: appName, name: appName, webPreferences: { - preload: path.join(__dirname, 'preload.js'), nodeIntegration: true, contextIsolation: false } }); - mainWindow.loadFile('index.html'); + await mainWindow.loadFile('index.html'); mainWindow.once('ready-to-show', () => { - setTimeout(() => { - splashWindow.close(); - mainWindow.show(); - }, 3000); // Show splash screen for 3 seconds + mainWindow.show(); }); } -let splashWindow; - app.on('ready', () => { - splashWindow = createSplashWindow(); createWindow(); }); diff --git a/macos-editor/package.json b/macos-editor/package.json index fdeaf0e..ee3c9d2 100644 --- a/macos-editor/package.json +++ b/macos-editor/package.json @@ -9,21 +9,34 @@ }, "author": "Carlos de Huerta", "scripts": { - "start": "tsc && electron .", - "build": "tsc && electron-builder" + "start": "tsc && esbuild ./src/index.tsx --bundle --outfile=./bundle.js --format=iife && electron .", + "build": "tsc && esbuild ./src/index.tsx --bundle --outfile=./bundle.js --format=iife && electron-builder" }, "dependencies": { "@tiptap/core": "^2.0.0-beta.22", "@tiptap/starter-kit": "^2.0.0-beta.22", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "@tiptap/extension-heading": "^2.12.0", + "@tiptap/extension-highlight": "^2.12.0", + "@tiptap/extension-image": "^2.12.0", + "@tiptap/extension-link": "^2.12.0", + "@tiptap/extension-subscript": "^2.12.0", + "@tiptap/extension-superscript": "^2.12.0", + "@tiptap/extension-task-item": "^2.12.0", + "@tiptap/extension-task-list": "^2.12.0", + "@tiptap/extension-text-align": "^2.12.0", + "@tiptap/extension-typography": "^2.12.0", + "@tiptap/extension-underline": "^2.12.0", + "@tiptap/react": "^2.12.0", + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@types/react": "^19.1.4", "@types/react-dom": "^19.1.5", "electron": "^36.2.1", "electron-builder": "^26.0.12", - "typescript": "^4.4.3" + "typescript": "^4.4.3", + "esbuild": "^0.12.15" }, "build": { "appId": "net.espora.pora", diff --git a/macos-editor/renderer.js b/macos-editor/renderer.js deleted file mode 100644 index 5037e70..0000000 --- a/macos-editor/renderer.js +++ /dev/null @@ -1 +0,0 @@ -// Elimina todo el código, ya que ahora el editor se maneja con React diff --git a/macos-editor/splash.html b/macos-editor/splash.html deleted file mode 100644 index 26bedaa..0000000 --- a/macos-editor/splash.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -

Pora Editor

- - diff --git a/macos-editor/src/index.jsx b/macos-editor/src/index.jsx deleted file mode 100644 index 371550c..0000000 --- a/macos-editor/src/index.jsx +++ /dev/null @@ -1,64 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import { EditorContent, useEditor } from "@tiptap/react"; -import StarterKit from "@tiptap/starter-kit"; -import Underline from "@tiptap/extension-underline"; -import Heading from "@tiptap/extension-heading"; -import TextAlign from "@tiptap/extension-text-align"; -import Highlight from "@tiptap/extension-highlight"; -import Link from "@tiptap/extension-link"; -import TaskList from "@tiptap/extension-task-list"; -import TaskItem from "@tiptap/extension-task-item"; -import Image from "@tiptap/extension-image"; -import Typography from "@tiptap/extension-typography"; -import Subscript from "@tiptap/extension-subscript"; -import Superscript from "@tiptap/extension-superscript"; - -function App() { - const editor = useEditor({ - extensions: [ - StarterKit, - Underline, - Heading.configure({ levels: [1, 2, 3] }), - TextAlign.configure({ types: ["heading", "paragraph"] }), - Highlight, - Link, - TaskList, - TaskItem, - Image, - Typography, - Subscript, - Superscript, - ], - content: '

Hello World!

', - }); - - return ( -
-
- - - - - - - - - - - - - - - - - - -
- -
- ); -} - -const root = createRoot(document.getElementById("app")); -root.render(); diff --git a/macos-editor/src/index.tsx b/macos-editor/src/index.tsx index 3457185..882cf31 100644 --- a/macos-editor/src/index.tsx +++ b/macos-editor/src/index.tsx @@ -1,11 +1,35 @@ import React from 'react'; import { EditorContent, useEditor } from '@tiptap/react'; import StarterKit from '@tiptap/starter-kit'; +import Underline from '@tiptap/extension-underline'; +import Heading from '@tiptap/extension-heading'; +import TextAlign from '@tiptap/extension-text-align'; +import Highlight from '@tiptap/extension-highlight'; +import Link from '@tiptap/extension-link'; +import TaskList from '@tiptap/extension-task-list'; +import TaskItem from '@tiptap/extension-task-item'; +import Image from '@tiptap/extension-image'; +import Typography from '@tiptap/extension-typography'; +import Subscript from '@tiptap/extension-subscript'; +import Superscript from '@tiptap/extension-superscript'; import './styles.scss'; const MacOSEditor: React.FC = () => { const editor = useEditor({ - extensions: [StarterKit], + extensions: [ + StarterKit, + Underline, + Heading.configure({ levels: [1, 2, 3] }), + TextAlign.configure({ types: ['heading', 'paragraph'] }), + Highlight, + Link, + TaskList, + TaskItem, + Image, + Typography, + Subscript, + Superscript, + ], content: '

Hello World!

', }); @@ -18,7 +42,22 @@ const MacOSEditor: React.FC = () => {
- + + + + + + + + + + + + + + + +