kuro223 commited on
Commit
a3cfed6
·
1 Parent(s): 910bc84
templates/admin_edit_article.html CHANGED
@@ -6,14 +6,14 @@
6
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.8/dist/trix.css">
7
  <style>
8
  /* Admin Editor Styles */
9
- .admin-editor {
10
- max-width: 1000px;
11
- margin: 0 auto;
12
- padding: var(--spacing-lg);
13
- background: var(--bg-card);
14
- border-radius: var(--card-radius);
15
- box-shadow: var(--shadow-md);
16
- }
17
 
18
  .editor-header {
19
  display: flex;
@@ -45,15 +45,15 @@
45
  font-weight: 500;
46
  }
47
 
48
- .form-control {
49
- width: 100%;
50
- padding: 0.75rem 1rem;
51
- border: 1px solid var(--border-color);
52
- border-radius: var(--btn-radius);
53
- background: var(--bg);
54
- color: var(--text);
55
- transition: all var(--transition-fast);
56
- }
57
 
58
  .form-control:focus {
59
  outline: none;
@@ -61,15 +61,15 @@
61
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
62
  }
63
 
64
- trix-editor {
65
- min-height: 300px;
66
- border: 1px solid var(--border-color);
67
- border-radius: var(--btn-radius);
68
- background: var(--bg);
69
- color: var(--text);
70
- padding: var(--spacing-md);
71
- margin-bottom: var(--spacing-lg);
72
- }
73
 
74
  trix-editor:focus {
75
  outline: none;
@@ -77,12 +77,12 @@
77
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
78
  }
79
 
80
- .preview-section {
81
- margin-top: var(--spacing-xl);
82
- padding: var(--spacing-lg);
83
- background: var(--bg-alt);
84
- border-radius: var(--card-radius);
85
- }
86
 
87
  .preview-header {
88
  margin-bottom: var(--spacing-md);
@@ -90,12 +90,12 @@
90
  border-bottom: 1px solid var(--border-color);
91
  }
92
 
93
- .preview-content {
94
- background: var(--bg);
95
- padding: var(--spacing-lg);
96
- border-radius: var(--card-radius);
97
- box-shadow: var(--shadow-sm);
98
- }
99
 
100
  /* Custom file input */
101
  .file-input-wrapper {
@@ -112,15 +112,15 @@
112
  cursor: pointer;
113
  }
114
 
115
- .file-input-trigger {
116
- display: block;
117
- padding: 0.75rem 1rem;
118
- border: 2px dashed var(--border-color);
119
- border-radius: var(--btn-radius);
120
- text-align: center;
121
- color: var(--text-light);
122
- transition: all var(--transition-fast);
123
- }
124
 
125
  .file-input-wrapper:hover .file-input-trigger {
126
  border-color: var(--primary-1);
@@ -213,10 +213,11 @@
213
  <button type="button" class="trix-button" data-trix-action="x-quote" title="Citation">"</button>
214
  <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" title="Lien">Lien</button>
215
  </span>
216
- <span class="trix-button-group">
217
- <button type="button" class="trix-button" data-trix-action="x-align-left" title="Aligner à gauche">←</button>
218
- <button type="button" class="trix-button" data-trix-action="x-align-right" title="Aligner à droite">→</button>
219
- </span>
 
220
  </div>`;
221
  };
222
  });
@@ -378,23 +379,7 @@
378
  };
379
  });
380
 
381
- // Handle image alignment
382
- document.addEventListener('trix-action-invoke', function(event) {
383
- var action = event.actionName || event.detail && event.detail.actionName;
384
- if (action === 'x-align-left' || action === 'x-align-right') {
385
- var target = event.target || event.detail && event.detail.target;
386
- if (!target) return;
387
- var editor = target.editor;
388
- var selectedRange = editor.getSelectedRange();
389
- var doc = editor.getDocument();
390
- var attachments = doc.getAttachments();
391
- attachments.forEach(function(att) {
392
- var range = att.getRange();
393
- if (selectedRange[0] <= range[0] && range[1] <= selectedRange[1])
394
- att.setAttribute('class', action === 'x-align-left' ? 'float-left' : 'float-right');
395
- });
396
- }
397
- });
398
 
399
  // Live preview updates
400
  function updatePreview() {
 
6
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.8/dist/trix.css">
7
  <style>
8
  /* Admin Editor Styles */
9
+ .admin-editor {
10
+ max-width: 1000px;
11
+ margin: 0 auto;
12
+ padding: var(--spacing-lg);
13
+ background: var(--bg-card);
14
+ border-radius: 8px;
15
+ box-shadow: var(--shadow-md);
16
+ }
17
 
18
  .editor-header {
19
  display: flex;
 
45
  font-weight: 500;
46
  }
47
 
48
+ .form-control {
49
+ width: 100%;
50
+ padding: 0.75rem 1rem;
51
+ border: 1px solid var(--border-color);
52
+ border-radius: 8px;
53
+ background: var(--bg);
54
+ color: var(--text);
55
+ transition: all var(--transition-fast);
56
+ }
57
 
58
  .form-control:focus {
59
  outline: none;
 
61
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
62
  }
63
 
64
+ trix-editor {
65
+ min-height: 300px;
66
+ border: 1px solid var(--border-color);
67
+ border-radius: 8px;
68
+ background: var(--bg);
69
+ color: var(--text);
70
+ padding: var(--spacing-md);
71
+ margin-bottom: var(--spacing-lg);
72
+ }
73
 
74
  trix-editor:focus {
75
  outline: none;
 
77
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
78
  }
79
 
80
+ .preview-section {
81
+ margin-top: var(--spacing-xl);
82
+ padding: var(--spacing-lg);
83
+ background: var(--bg-alt);
84
+ border-radius: 8px;
85
+ }
86
 
87
  .preview-header {
88
  margin-bottom: var(--spacing-md);
 
90
  border-bottom: 1px solid var(--border-color);
91
  }
92
 
93
+ .preview-content {
94
+ background: var(--bg);
95
+ padding: var(--spacing-lg);
96
+ border-radius: 8px;
97
+ box-shadow: var(--shadow-sm);
98
+ }
99
 
100
  /* Custom file input */
101
  .file-input-wrapper {
 
112
  cursor: pointer;
113
  }
114
 
115
+ .file-input-trigger {
116
+ display: block;
117
+ padding: 0.75rem 1rem;
118
+ border: 2px dashed var(--border-color);
119
+ border-radius: 8px;
120
+ text-align: center;
121
+ color: var(--text-light);
122
+ transition: all var(--transition-fast);
123
+ }
124
 
125
  .file-input-wrapper:hover .file-input-trigger {
126
  border-color: var(--primary-1);
 
213
  <button type="button" class="trix-button" data-trix-action="x-quote" title="Citation">"</button>
214
  <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" title="Lien">Lien</button>
215
  </span>
216
+ <span class="trix-button-group">
217
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="left" title="Aligner à gauche">←</button>
218
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="center" title="Centrer">⫸</button>
219
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="right" title="Aligner à droite">→</button>
220
+ </span>
221
  </div>`;
222
  };
223
  });
 
379
  };
380
  });
381
 
382
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
 
384
  // Live preview updates
385
  function updatePreview() {
templates/admin_new_article.html CHANGED
@@ -66,16 +66,21 @@
66
  Trix.config.toolbar.getDefaultHTML = function(){
67
  return `
68
  <div class="trix-button-row">
69
- <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
70
- <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" title="Gras">Gras</button>
71
- <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" title="Italique">Italique</button>
72
- <button type="button" class="trix-button" data-trix-action="x-heading" title="Titre">H</button>
73
- <button type="button" class="trix-button" data-trix-action="x-quote" title="Citation">"</button>
74
- </span>
75
- <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
76
- <button type="button" class="trix-button" data-trix-action="undo" title="Annuler">⟲</button>
77
- <button type="button" class="trix-button" data-trix-action="redo" title="Refaire">⟲</button>
78
- </span>
 
 
 
 
 
79
  </div>`;
80
  };
81
  });
@@ -164,19 +169,7 @@
164
  reader.readAsDataURL(file);
165
  });
166
 
167
- // alignment helper via custom action hooks
168
- document.addEventListener('trix-action-invoke', function(event){
169
- var action = event.actionName || event.detail && event.detail.actionName;
170
- // some Trix builds use different event payloads; we handle common case above
171
- if(action === 'x-align-left' || action === 'x-align-right'){
172
- var target = event.target || event.detail && event.detail.target; if(!target) return;
173
- var editor = target.editor;
174
- var selectedRange = editor.getSelectedRange();
175
- var doc = editor.getDocument();
176
- var attachments = doc.getAttachments();
177
- attachments.forEach(function(att){ var range = att.getRange(); if(selectedRange[0] <= range[0] && range[1] <= selectedRange[1]){ att.setAttribute('class', action === 'x-align-left' ? 'float-left' : 'float-right'); }});
178
- }
179
- });
180
 
181
  // Live preview update
182
  document.addEventListener('trix-change', function(){
 
66
  Trix.config.toolbar.getDefaultHTML = function(){
67
  return `
68
  <div class="trix-button-row">
69
+ <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
70
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" title="Gras">Gras</button>
71
+ <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" title="Italique">Italique</button>
72
+ <button type="button" class="trix-button" data-trix-action="x-heading" title="Titre">H</button>
73
+ <button type="button" class="trix-button" data-trix-action="x-quote" title="Citation">"</button>
74
+ </span>
75
+ <span class="trix-button-group">
76
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="left" title="Aligner à gauche">←</button>
77
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="center" title="Centrer">⫸</button>
78
+ <button type="button" class="trix-button" data-trix-attribute="textAlign" data-trix-value="right" title="Aligner à droite">→</button>
79
+ </span>
80
+ <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
81
+ <button type="button" class="trix-button" data-trix-action="undo" title="Annuler">⟲</button>
82
+ <button type="button" class="trix-button" data-trix-action="redo" title="Refaire">⟲</button>
83
+ </span>
84
  </div>`;
85
  };
86
  });
 
169
  reader.readAsDataURL(file);
170
  });
171
 
172
+
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  // Live preview update
175
  document.addEventListener('trix-change', function(){