Skip to content

Create TextNode with Inline Editing #18

Closed

Description

@malibio

Create TextNode component that extends enhanced BaseNode with text-specific functionality and inline editing capabilities.

Dependencies

Related Issues

Requirements

  • Component structure: TextNode.svelte extends BaseNode with text-specific props
  • Inline editing: Click-to-edit functionality with save/cancel states
  • Content props: content: string, editable?: boolean, markdown?: boolean, placeholder?: string
  • Editing states: Visual feedback for edit mode vs display mode
  • Keyboard shortcuts: Ctrl+Enter to save, Esc to cancel editing
  • Auto-resize: Text area expands with content during editing
  • Mock service: Create mockTextService.ts for simulated CRUD operations and auto-save
  • Basic markdown: Simple rendering support for headers, bold, italic
  • Content preservation: Maintain formatting between edit and display modes

Technical Implementation

  • File Location: Create src/lib/components/TextNode.svelte
  • Base Extension: Use enhanced BaseNode as wrapper component
  • State Management: Local Svelte stores for edit state, content, save status
  • Mock Service: Create src/lib/services/mockTextService.ts following development process patterns
  • Markdown Library: Use simple markdown parser or basic regex for headers/bold/italic
  • Reference: Follow existing component patterns and development process examples

Component Structure

<script lang="ts">
  import BaseNode from '$lib/design/components/BaseNode.svelte';
  export let content: string = '';
  export let editable: boolean = true;
  export let nodeId: string;
  export let title: string = '';
  
  let isEditing = false;
  let editContent = content;
  // State management and editing logic
</script>

<BaseNode 
  {nodeId} 
  {title} 
  nodeType="text"
  hasChildren={false}
  on:click={handleClick}
>
  <div slot="content">
    {#if isEditing}
      <\!-- Inline editor -->
    {:else}
      <\!-- Display content with markdown -->
    {/if}
  </div>
</BaseNode>

Mock Service Pattern

  • Follow development process mock service examples
  • Simulate network delays and auto-save behavior
  • Provide CRUD operations: save, load, delete
  • Return promises for async operations

Acceptance Criteria

  • TextNode renders with proper text icon in circle indicator
  • Click-to-edit works smoothly with visual state transitions
  • Keyboard shortcuts function correctly (Ctrl+Enter save, Esc cancel)
  • Content persists through edit/cancel operations
  • Basic markdown renders in display mode (headers, bold, italic)
  • Component works in different panel contexts (sidebar, main content)
  • Auto-save simulation works with mock service
  • Text area auto-resizes during editing

Activity

  1. self-assigned this
    on Aug 6, 2025
  2. added a commit that references this issue on Aug 6, 2025
  3. added a commit that references this issue on Feb 4, 2026
  4. added a commit that references this issue on Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions