File size: 2,096 Bytes
58d09df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
class CustomEditor extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: flex;
          flex-direction: column;
          flex: 1;
          padding: 2rem;
          overflow-y: auto;
        }
        
        .toolbar {
          display: flex;
          gap: 0.5rem;
          margin-bottom: 1rem;
          padding-bottom: 1rem;
          border-bottom: 1px solid #e2e8f0;
        }
        
        .tool-btn {
          background: none;
          border: none;
          padding: 0.5rem;
          border-radius: 4px;
          cursor: pointer;
          transition: all 0.2s;
        }
        
        .tool-btn:hover {
          background-color: #c0f0e2;
        }
        
        .content {
          min-height: 100%;
          outline: none;
        }
        
        .content h1 {
          font-size: 2rem;
          margin-bottom: 1.5rem;
          color: #5aa58b;
          font-family: 'Inter', sans-serif;
        }
        
        .content p {
          line-height: 1.6;
          margin-bottom: 1rem;
          font-family: 'Inter', sans-serif;
        }
      </style>
      
      <div class="toolbar">
        <button class="tool-btn">H1</button>
        <button class="tool-btn">H2</button>
        <button class="tool-btn">B</button>
        <button class="tool-btn">I</button>
        <button class="tool-btn">πŸ“‹</button>
        <button class="tool-btn">βœ…</button>
      </div>
      
      <div class="content" contenteditable="true">
        <h1>Welcome to MindFlow</h1>
        <p>Start writing or type '/' for commands...</p>
      </div>
    `;
    
    // Add editor functionality
    const content = this.shadowRoot.querySelector('.content');
    
    content.addEventListener('keydown', (e) => {
      if (e.key === '/') {
        this.showCommandMenu();
      }
    });
  }
  
  showCommandMenu() {
    // TODO: Implement command menu
    console.log('Show command menu');
  }
}

customElements.define('custom-editor', CustomEditor);