codebybrody commited on
Commit
cc67c20
路
verified 路
1 Parent(s): 269ea4c

Upload 61 files

Browse files
components/DataForm.tsx CHANGED
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
2
  import { DataItem, LinkGroup } from '../types';
3
  import { Button } from './Button';
4
  import { IconPicker } from './IconPicker';
 
5
  import { Save, X, Link as LinkIcon, Download, Hash, Sparkles } from 'lucide-react';
6
 
7
  interface DataFormProps {
@@ -82,13 +83,20 @@ export const DataForm: React.FC<DataFormProps> = ({ initialData, onSave, onCance
82
  <div className="flex justify-between items-center mb-2">
83
  <label className="block text-sm font-medium text-gray-400">Resumen / Descripci贸n Principal</label>
84
  </div>
85
- <textarea
86
- rows={4}
87
- className="w-full bg-background border border-white/10 rounded-lg p-4 text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none transition-colors resize-y"
88
- value={summary}
89
- onChange={(e) => setSummary(e.target.value)}
90
- placeholder="Descripci贸n principal de la tarjeta..."
91
- />
 
 
 
 
 
 
 
92
  </div>
93
 
94
  <div className="grid grid-cols-1 md:grid-cols-2 gap-6 p-6 bg-background/30 rounded-xl border border-white/5">
 
2
  import { DataItem, LinkGroup } from '../types';
3
  import { Button } from './Button';
4
  import { IconPicker } from './IconPicker';
5
+ import { TipTapEditor } from './TipTapEditor';
6
  import { Save, X, Link as LinkIcon, Download, Hash, Sparkles } from 'lucide-react';
7
 
8
  interface DataFormProps {
 
83
  <div className="flex justify-between items-center mb-2">
84
  <label className="block text-sm font-medium text-gray-400">Resumen / Descripci贸n Principal</label>
85
  </div>
86
+ <div className="bg-background border border-white/10 rounded-lg overflow-hidden focus-within:border-primary focus-within:ring-1 focus-within:ring-primary transition-colors">
87
+ <TipTapEditor
88
+ content={summary}
89
+ onUpdate={(content) => {
90
+ if (typeof content === 'string') {
91
+ setSummary(content);
92
+ }
93
+ }}
94
+ isEditable={true}
95
+ showToolbarOnFocus={true}
96
+ className="px-3 py-2 min-h-[100px]"
97
+ dense={false}
98
+ />
99
+ </div>
100
  </div>
101
 
102
  <div className="grid grid-cols-1 md:grid-cols-2 gap-6 p-6 bg-background/30 rounded-xl border border-white/5">
components/DetailView.tsx CHANGED
@@ -714,7 +714,7 @@ export const DetailView: React.FC<DetailViewProps> = ({ item, onBack, onUpdate,
714
  content={item.summary || '<p>Resumen</p>'}
715
  onUpdate={() => { }}
716
  isEditable={false}
717
- className="text-gray-300 text-base leading-relaxed max-w-4xl mb-4 [&>p]:m-0 min-h-0"
718
  dense={true}
719
  />
720
 
 
714
  content={item.summary || '<p>Resumen</p>'}
715
  onUpdate={() => { }}
716
  isEditable={false}
717
+ className="text-gray-300 text-base leading-relaxed max-w-4xl mb-4 [&>p]:mb-5 last:[&>p]:mb-0 min-h-0"
718
  dense={true}
719
  />
720
 
components/TipTapEditor.tsx CHANGED
@@ -182,7 +182,7 @@ export const TipTapEditor: React.FC<TipTapEditorProps> = ({
182
  ArrowDownHandler,
183
  ...extensions
184
  ],
185
- content: content,
186
  editable: isEditable,
187
  autofocus: autoFocus,
188
  onUpdate: ({ editor }) => {
@@ -209,7 +209,7 @@ export const TipTapEditor: React.FC<TipTapEditorProps> = ({
209
  // Context menu handler removed
210
  },
211
  attributes: {
212
- class: `prose prose-invert max-w-none focus:outline-none ${dense ? 'min-h-[40px]' : 'min-h-[50px]'} !h-auto prose-headings:font-bold prose-h1:text-3xl prose-h2:text-2xl prose-p:text-gray-300 prose-p:leading-relaxed prose-p:my-3 prose-blockquote:not-italic prose-pre:bg-[#000000] prose-pre:text-gray-300 prose-code:text-primary prose-code:rounded prose-code:px-1 prose-code:py-1 prose-code:leading-relaxed prose-code:decoration-clone prose-code:before:content-none prose-code:after:content-none prose-hr:border-white/10 ${className}`,
213
  style: `
214
  --code-font-family: ${styleConfig.code.fontFamily};
215
  `
@@ -317,8 +317,13 @@ export const TipTapEditor: React.FC<TipTapEditorProps> = ({
317
  if (editor && content && JSON.stringify(editor.getJSON()) !== JSON.stringify(content)) {
318
  // Specialized content set for HTML string vs JSON
319
  if (typeof content === 'string') {
320
- if (editor.getHTML() !== content) {
321
- editor.commands.setContent(content);
 
 
 
 
 
322
  }
323
  } else {
324
  editor.commands.setContent(content);
@@ -412,7 +417,6 @@ export const TipTapEditor: React.FC<TipTapEditorProps> = ({
412
 
413
  {isSettingsOpen && (
414
  <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4">
415
- {console.log('[TipTapEditor] Opening Settings. editingBlockIndex:', editingBlockIndex, 'cardStyle passed:', cardStyle)}
416
  <div className="bg-[#1e1e1e] rounded-xl shadow-2xl w-full max-w-2xl h-[85vh] flex flex-col overflow-hidden border border-white/10">
417
  <StyleSettingsPanel
418
  styleConfig={getSettingsPanelConfig()}
 
182
  ArrowDownHandler,
183
  ...extensions
184
  ],
185
+ content: (typeof content === 'string' && !content.includes('<') && content.includes('\n')) ? content.replace(/\n/g, '<br>') : content,
186
  editable: isEditable,
187
  autofocus: autoFocus,
188
  onUpdate: ({ editor }) => {
 
209
  // Context menu handler removed
210
  },
211
  attributes: {
212
+ class: `prose prose-invert max-w-none focus:outline-none whitespace-pre-wrap prose-p:whitespace-pre-wrap ${dense ? 'min-h-[40px]' : 'min-h-[50px]'} !h-auto prose-headings:font-bold prose-h1:text-3xl prose-h2:text-2xl prose-p:text-gray-300 prose-p:leading-relaxed prose-p:my-4 prose-blockquote:not-italic prose-pre:bg-[#000000] prose-pre:text-gray-300 prose-code:text-primary prose-code:rounded prose-code:px-1 prose-code:py-1 prose-code:leading-relaxed prose-code:decoration-clone prose-code:before:content-none prose-code:after:content-none prose-hr:border-white/10 ${className}`,
213
  style: `
214
  --code-font-family: ${styleConfig.code.fontFamily};
215
  `
 
317
  if (editor && content && JSON.stringify(editor.getJSON()) !== JSON.stringify(content)) {
318
  // Specialized content set for HTML string vs JSON
319
  if (typeof content === 'string') {
320
+ let processedContent = content;
321
+ if (!processedContent.includes('<') && processedContent.includes('\n')) {
322
+ processedContent = processedContent.replace(/\n/g, '<br>');
323
+ }
324
+
325
+ if (editor.getHTML() !== processedContent) {
326
+ editor.commands.setContent(processedContent);
327
  }
328
  } else {
329
  editor.commands.setContent(content);
 
417
 
418
  {isSettingsOpen && (
419
  <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4">
 
420
  <div className="bg-[#1e1e1e] rounded-xl shadow-2xl w-full max-w-2xl h-[85vh] flex flex-col overflow-hidden border border-white/10">
421
  <StyleSettingsPanel
422
  styleConfig={getSettingsPanelConfig()}