Revert "Replace House with Lexical"

This commit is contained in:
Jorge Manrubia
2025-05-29 14:22:27 +02:00
committed by GitHub
parent ba54ed6104
commit 08d8b2e5ff
50 changed files with 576 additions and 916 deletions
+1 -3
View File
@@ -2,6 +2,4 @@
import "@hotwired/turbo-rails"
import "initializers"
import "controllers"
import "actiontext-lexical"
import "@rails/actiontext"
import "house"
@@ -30,10 +30,9 @@ export default class extends Controller {
async restoreContent() {
await nextFrame()
let savedContent = localStorage.getItem(this.keyValue)
const savedContent = localStorage.getItem(this.keyValue)
if (savedContent) {
savedContent = `<div>${savedContent}</div>` // temporary for old markdown saves
this.inputTarget.value = savedContent
this.#triggerChangeEvent(savedContent)
}
@@ -46,8 +45,8 @@ export default class extends Controller {
}
#triggerChangeEvent(newValue) {
if (this.inputTarget.tagName === "LEXICAL-EDITOR") {
this.inputTarget.dispatchEvent(new CustomEvent('actiontext:change', {
if (this.inputTarget.tagName === "HOUSE-MD") {
this.inputTarget.dispatchEvent(new CustomEvent('house-md:change', {
bubbles: true,
detail: {
previousContent: '',
@@ -0,0 +1,28 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
pasteFiles(event) {
const editor = event.target.closest("house-md")
if (!editor) return
const files = event.clipboardData?.files
if (!files?.length) return
event.preventDefault()
for (const file of files) {
const uploadEvent = new CustomEvent("house-md:before-upload", {
bubbles: true,
detail: { file },
cancelable: true
})
if (editor.dispatchEvent(uploadEvent)) {
const upload = document.createElement("house-md-upload")
upload.file = file
upload.uploadsURL = editor.dataset.uploadsUrl
editor.appendChild(upload)
}
}
}
}
@@ -1,8 +0,0 @@
import { Controller } from "@hotwired/stimulus"
import { highlightAll } from "actiontext-lexical"
export default class extends Controller {
connect() {
highlightAll()
}
}