Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

test

louloudev59141146d8032e
diff --cc frontend/app/components/MarkdownEditor/ColorPickerModal.vue
index f285807b,1b9a1ef1..46d7c365
--- a/frontend/app/components/MarkdownEditor/ColorPickerModal.vue
+++ b/frontend/app/components/MarkdownEditor/ColorPickerModal.vue
@@@ -2,25 -2,34 +2,54 @@@
<div class="color-picker-modal">
<div class="modal-header">
<div class="header-icon">
++<<<<<<< HEAD
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="13.5" cy="6.5" r=".5"/>
+ <circle cx="17.5" cy="10.5" r=".5"/>
+ <circle cx="8.5" cy="7.5" r=".5"/>
+ <circle cx="6.5" cy="12.5" r=".5"/>
+ <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 011.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/>
+</svg>
++=======
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <circle cx="13.5" cy="6.5" r=".5" />
+ <circle cx="17.5" cy="10.5" r=".5" />
+ <circle cx="8.5" cy="7.5" r=".5" />
+ <circle cx="6.5" cy="12.5" r=".5" />
+ <path
+ d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 011.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"
+ />
+ </svg>
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</div>
<h3>Color Palette</h3>
<p class="header-subtitle">Choose from predefined colors or use the color wheel</p>
</div>
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="modal-content">
<div class="section">
<h4 class="section-title">Quick Colors</h4>
<div class="swatches">
++<<<<<<< HEAD
+ <button
+ v-for="(color, index) in availableColors"
++=======
+ <button
+ v-for="color in availableColors"
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
:key="color"
class="swatch"
:class="{ 'primary-color': color === 'primary' }"
@@@ -33,57 -42,48 +62,93 @@@
<div class="swatch-inner">
<div class="swatch-check" v-if="hoveredColor === color">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
++<<<<<<< HEAD
+ <polyline points="20,6 9,17 4,12"/>
++=======
+ <polyline points="20,6 9,17 4,12" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</svg>
</div>
</div>
</button>
</div>
</div>
++<<<<<<< HEAD
+
+ <div class="section">
+ <h4 class="section-title">
+ Custom Color
+ </h4>
+ <div class="custom">
+ <div class="color-wheel-section">
+ <div class="color-wheel-container">
+ <canvas
+ ref="colorWheel"
++=======
+
+ <div class="section">
+ <h4 class="section-title">Custom Color</h4>
+ <div class="custom">
+ <div class="color-wheel-section">
+ <div class="color-wheel-container">
+ <canvas
+ ref="colorWheel"
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
class="color-wheel"
@mousedown="startColorSelection"
@mousemove="updateColorSelection"
@mouseup="stopColorSelection"
@click="selectColorFromWheel"
></canvas>
++<<<<<<< HEAD
+ <div
+ class="color-wheel-cursor"
+ :style="{
+ left: `${cursorPosition.x}px`,
+ top: `${cursorPosition.y}px`,
+ background: selectedWheelColor
+ }"
+ ></div>
+ </div>
+
++=======
+ <div
+ class="color-wheel-cursor"
+ :style="{
+ left: `${cursorPosition.x}px`,
+ top: `${cursorPosition.y}px`,
+ background: selectedWheelColor,
+ }"
+ ></div>
+ </div>
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="color-controls">
<div class="control-group">
<label>Brightness</label>
<div class="slider-container">
++<<<<<<< HEAD
+ <input
+ type="range"
+ min="0"
+ max="100"
+ v-model="brightness"
+ class="brightness-slider"
+ @input="updateWheelColor"
+ />
++=======
+ <input v-model="brightness" type="range" min="0" max="100" class="brightness-slider" @input="updateWheelColor" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="slider-track">
<div class="slider-fill" :style="{ width: `${brightness}%` }"></div>
</div>
</div>
</div>
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="selected-color-preview">
<div class="preview-circle" :style="{ background: selectedWheelColor }"></div>
<div class="color-info">
@@@ -91,48 -91,41 +156,80 @@@
<span class="hsv-values">HSV({{ hue }}, {{ saturation }}%, {{ brightness }}%)</span>
</div>
</div>
++<<<<<<< HEAD
+
+ <button class="validate-wheel-btn" @click="validateWheelColor">
+ <svg class="btn-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M5 13l4 4L19 7"/>
++=======
+
+ <button class="validate-wheel-btn" @click="validateWheelColor">
+ <svg class="btn-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M5 13l4 4L19 7" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</svg>
<span class="btn-text">Use This Color</span>
</button>
</div>
</div>
++<<<<<<< HEAD
+
+ <div class="input-group">
+ <div class="input-wrapper">
+ <span class="input-prefix">#</span>
+ <input
+ v-model="hexColor"
+ class="hex"
+ placeholder="RRGGBB"
+ maxlength="6"
+ @keyup.enter="applyCustomColor"
+ @input="validateHexInput"
+ />
++=======
+
+ <div class="input-group">
+ <div class="input-wrapper">
+ <span class="input-prefix">#</span>
+ <input v-model="hexColor" class="hex" placeholder="RRGGBB" maxlength="6" @keyup.enter="applyCustomColor" @input="validateHexInput" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</div>
<div class="color-preview" :style="{ background: hexColor && /^[0-9A-F]{6}$/i.test(hexColor) ? `#${hexColor}` : 'transparent' }">
<div class="preview-border"></div>
</div>
</div>
++<<<<<<< HEAD
+
+ <button class="apply" @click="applyCustomColor" :disabled="!isValidHex">
+ <span class="btn-text">Apply Color</span>
+ <svg class="btn-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M5 13l4 4L19 7"/>
++=======
+
+ <button class="apply" :disabled="!isValidHex" @click="applyCustomColor">
+ <span class="btn-text">Apply Color</span>
+ <svg class="btn-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M5 13l4 4L19 7" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</svg>
</button>
</div>
</div>
</div>
++<<<<<<< HEAD
+
+ <div class="modal-footer">
+ <button class="cancel-btn" @click="closeModal">
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <line x1="18" y1="6" x2="6" y2="18"/>
+ <line x1="6" y1="6" x2="18" y2="18"/>
++=======
+
+ <div class="modal-footer">
+ <button class="cancel-btn" @click="closeModal">
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <line x1="18" y1="6" x2="6" y2="18" />
+ <line x1="6" y1="6" x2="18" y2="18" />
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</svg>
<span>Cancel</span>
</button>
@@@ -141,9 -134,6 +238,12 @@@
</template>
<script setup lang="ts">
++<<<<<<< HEAD
+import { ref, computed, onMounted, nextTick } from 'vue';
+import { getAppColor } from '~/composables/utils';
+
++=======
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
const props = defineProps<{
onColorSelect: (color: string) => void;
}>();
@@@ -162,10 -152,7 +262,14 @@@ const brightness = ref(100)
const selectedWheelColor = ref('#FF0000');
const cursorPosition = ref({ x: 150, y: 75 });
++<<<<<<< HEAD
+const availableColors = [
+ 'primary',
+ ...Array.from({ length: 8 }, (_, i) => getAppColor(i))
+];
++=======
+ const availableColors = ['primary', ...Array.from({ length: 8 }, (_, i) => getAppColor(i))];
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
const isValidHex = computed(() => {
return hexColor.value && /^[0-9A-F]{6}$/i.test(hexColor.value);
@@@ -187,28 -174,28 +291,53 @@@ const stopColorSelection = () =>
const updateColorSelection = (e: MouseEvent) => {
if (!isSelecting.value || !colorWheel.value) return;
++<<<<<<< HEAD
+
+ const rect = colorWheel.value.getBoundingClientRect();
+ const x = e.clientX - rect.left;
+ const y = e.clientY - rect.top;
+
+ const centerX = rect.width / 2;
+ const centerY = rect.height / 2;
+
+ const deltaX = x - centerX;
+ const deltaY = y - centerY;
+
+ const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ const maxDistance = Math.min(centerX, centerY);
+
+ if (distance <= maxDistance) {
+ cursorPosition.value = { x, y };
+
+ const angle = Math.atan2(deltaY, deltaX) * (180 / Math.PI);
+ hue.value = angle < 0 ? angle + 360 : angle;
+
+ saturation.value = Math.min(100, (distance / maxDistance) * 100);
+
++=======
+
+ const rect = colorWheel.value.getBoundingClientRect();
+ const x = e.clientX - rect.left;
+ const y = e.clientY - rect.top;
+
+ const centerX = rect.width / 2;
+ const centerY = rect.height / 2;
+
+ const deltaX = x - centerX;
+ const deltaY = y - centerY;
+
+ const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ const maxDistance = Math.min(centerX, centerY);
+
+ if (distance <= maxDistance) {
+ cursorPosition.value = { x, y };
+
+ const angle = Math.atan2(deltaY, deltaX) * (180 / Math.PI);
+ hue.value = angle < 0 ? angle + 360 : angle;
+
+ saturation.value = Math.min(100, (distance / maxDistance) * 100);
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
updateWheelColor();
}
};
@@@ -227,72 -214,92 +356,148 @@@ const updateWheelColor = () =>
const h = hue.value;
const s = saturation.value;
const v = brightness.value;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
selectedWheelColor.value = hsvToHex(h, s, v);
};
const hsvToHex = (h: number, s: number, v: number): string => {
const c = (v / 100) * (s / 100);
++<<<<<<< HEAD
+ const x = c * (1 - Math.abs((h / 60) % 2 - 1));
+ const m = (v / 100) - c;
+
+ let r = 0, g = 0, b = 0;
+
+ if (h >= 0 && h < 60) {
+ r = c; g = x; b = 0;
+ } else if (h >= 60 && h < 120) {
+ r = x; g = c; b = 0;
+ } else if (h >= 120 && h < 180) {
+ r = 0; g = c; b = x;
+ } else if (h >= 180 && h < 240) {
+ r = 0; g = x; b = c;
+ } else if (h >= 240 && h < 300) {
+ r = x; g = 0; b = c;
+ } else if (h >= 300 && h < 360) {
+ r = c; g = 0; b = x;
+ }
+
+ const rHex = Math.round((r + m) * 255).toString(16).padStart(2, '0');
+ const gHex = Math.round((g + m) * 255).toString(16).padStart(2, '0');
+ const bHex = Math.round((b + m) * 255).toString(16).padStart(2, '0');
+
++=======
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
+ const m = v / 100 - c;
+
+ let r = 0,
+ g = 0,
+ b = 0;
+
+ if (h >= 0 && h < 60) {
+ r = c;
+ g = x;
+ b = 0;
+ } else if (h >= 60 && h < 120) {
+ r = x;
+ g = c;
+ b = 0;
+ } else if (h >= 120 && h < 180) {
+ r = 0;
+ g = c;
+ b = x;
+ } else if (h >= 180 && h < 240) {
+ r = 0;
+ g = x;
+ b = c;
+ } else if (h >= 240 && h < 300) {
+ r = x;
+ g = 0;
+ b = c;
+ } else if (h >= 300 && h < 360) {
+ r = c;
+ g = 0;
+ b = x;
+ }
+
+ const rHex = Math.round((r + m) * 255)
+ .toString(16)
+ .padStart(2, '0');
+ const gHex = Math.round((g + m) * 255)
+ .toString(16)
+ .padStart(2, '0');
+ const bHex = Math.round((b + m) * 255)
+ .toString(16)
+ .padStart(2, '0');
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
return `#${rHex}${gHex}${bHex}`.toUpperCase();
};
const drawColorWheel = () => {
if (!colorWheel.value) return;
++<<<<<<< HEAD
+
+ const canvas = colorWheel.value;
+ const ctx = canvas.getContext('2d');
+ if (!ctx) return;
+
++=======
+
+ const canvas = colorWheel.value;
+ const ctx = canvas.getContext('2d');
+ if (!ctx) return;
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
const width = canvas.width;
const height = canvas.height;
const centerX = width / 2;
const centerY = height / 2;
const radius = Math.min(centerX, centerY) - 10;
++<<<<<<< HEAD
+
+ ctx.clearRect(0, 0, width, height);
+
++=======
+
+ ctx.clearRect(0, 0, width, height);
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const deltaX = x - centerX;
const deltaY = y - centerY;
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
if (distance <= radius) {
const angle = Math.atan2(deltaY, deltaX) * (180 / Math.PI);
const hue = angle < 0 ? angle + 360 : angle;
const saturation = Math.min(100, (distance / radius) * 100);
const value = 100;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
const color = hsvToHex(hue, saturation, value);
ctx.fillStyle = color;
ctx.fillRect(x, y, 1, 1);
}
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
// Draw outer circle
ctx.strokeStyle = 'var(--border-color)';
ctx.lineWidth = 2;
@@@ -345,7 -352,7 +550,11 @@@ onMounted(async () =>
padding: 24px 0 20px 0;
flex-shrink: 0;
text-align: center;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.header-icon {
width: 48px;
height: 48px;
@@@ -356,13 -363,13 +565,21 @@@
justify-content: center;
margin-bottom: 16px;
color: white;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
svg {
width: 24px;
height: 24px;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
h3 {
margin: 0 0 8px 0;
font-size: 24px;
@@@ -374,7 -381,7 +591,11 @@@
-webkit-text-fill-color: transparent;
background-clip: text;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.header-subtitle {
margin: 0;
font-size: 14px;
@@@ -394,20 -401,20 +615,36 @@@
overflow-y: auto;
min-height: 0;
padding-right: 8px;
++<<<<<<< HEAD
+
+ &::-webkit-scrollbar {
+ width: 6px;
+ }
+
++=======
+
+ &::-webkit-scrollbar {
+ width: 6px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::-webkit-scrollbar-track {
background: var(--bg-color-secondary);
border-radius: 3px;
}
++<<<<<<< HEAD
+
+ &::-webkit-scrollbar-thumb {
+ background: var(--border-color);
+ border-radius: 3px;
+
++=======
+
+ &::-webkit-scrollbar-thumb {
+ background: var(--border-color);
+ border-radius: 3px;
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
background: var(--primary);
}
@@@ -427,14 -434,14 +664,22 @@@
display: flex;
align-items: center;
gap: 12px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.section-icon {
width: 20px;
height: 20px;
color: var(--primary);
flex-shrink: 0;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::before {
content: '';
position: absolute;
@@@ -468,12 -475,12 +713,20 @@@
position: relative;
overflow: hidden;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&.primary-color {
border-color: var(--primary);
box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.swatch-inner {
width: 100%;
height: 100%;
@@@ -482,27 -489,27 +735,47 @@@
justify-content: center;
position: relative;
}
++<<<<<<< HEAD
+
+ .swatch-check {
+ color: white;
+ filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
+
++=======
+
+ .swatch-check {
+ color: white;
+ filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
svg {
width: 18px;
height: 18px;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
transform: translateY(-4px) scale(1.1);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
border-color: var(--primary);
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&.primary-color {
box-shadow: 0 16px 40px rgba(var(--primary-rgb), 0.4);
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:active {
transform: translateY(-2px) scale(1.05);
}
@@@ -580,7 -587,7 +853,11 @@@
cursor: pointer;
position: relative;
z-index: 2;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
@@@ -592,7 -599,7 +869,11 @@@
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::-moz-range-thumb {
width: 18px;
height: 18px;
@@@ -647,14 -654,14 +928,22 @@@
display: flex;
flex-direction: column;
gap: 2px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.hex-value {
font-size: 14px;
font-weight: 700;
color: var(--font-color-dark);
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.hsv-values {
font-size: 11px;
color: var(--font-color-light);
@@@ -682,29 -689,29 +971,49 @@@
min-height: 40px;
position: relative;
z-index: 100;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
background: linear-gradient(135deg, #2563eb, #1e40af);
border-color: #1e3a8a;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-icon {
transform: scale(1.1);
}
}
++<<<<<<< HEAD
+
+ &:active {
+ transform: translateY(0);
+ }
+
++=======
+
+ &:active {
+ transform: translateY(0);
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-icon {
width: 14px;
height: 14px;
transition: all 0.3s ease;
color: white;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-text {
font-weight: 600;
color: white;
@@@ -726,7 -733,7 +1035,11 @@@
border-radius: 10px;
overflow: hidden;
transition: all 0.3s ease;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:focus-within {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
@@@ -753,11 -760,11 +1066,19 @@@
font-weight: 600;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
letter-spacing: 1px;
++<<<<<<< HEAD
+
+ &:focus {
+ outline: none;
+ }
+
++=======
+
+ &:focus {
+ outline: none;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::placeholder {
color: var(--font-color-light);
font-weight: 400;
@@@ -771,7 -778,7 +1092,11 @@@
border: 2px solid var(--border-color);
position: relative;
overflow: hidden;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.preview-border {
position: absolute;
inset: 0;
@@@ -783,8 -790,12 +1108,17 @@@
}
@keyframes shimmer {
++<<<<<<< HEAD
+ 0% { transform: translateX(-100%); }
+ 100% { transform: translateX(100%); }
++=======
+ 0% {
+ transform: translateX(-100%);
+ }
+ 100% {
+ transform: translateX(100%);
+ }
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
}
.apply {
@@@ -801,32 -812,32 +1135,56 @@@
align-items: center;
justify-content: center;
gap: 8px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:not(:disabled) {
&:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.4);
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-icon {
transform: scale(1.1) rotate(5deg);
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:active {
transform: translateY(0);
}
}
++<<<<<<< HEAD
+
+ .btn-text {
+ font-weight: 600;
+ }
+
++=======
+
+ .btn-text {
+ font-weight: 600;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-icon {
width: 16px;
height: 16px;
@@@ -840,7 -851,7 +1198,11 @@@
justify-content: center;
gap: 16px;
flex-shrink: 0;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.cancel-btn {
padding: 12px 24px;
border: 2px solid var(--border-color);
@@@ -854,12 -865,12 +1216,20 @@@
display: flex;
align-items: center;
gap: 8px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
svg {
width: 14px;
height: 14px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
background: var(--border-color);
border-color: var(--primary);
@@@ -867,7 -878,7 +1237,11 @@@
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:active {
transform: translateY(0);
}
@@@ -878,87 -889,87 +1252,157 @@@
.color-picker-modal {
padding: 0 16px;
}
++<<<<<<< HEAD
+
+ .modal-header {
+ padding: 24px 0 20px 0;
+
++=======
+
+ .modal-header {
+ padding: 24px 0 20px 0;
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.header-icon {
width: 40px;
height: 40px;
margin-bottom: 12px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
svg {
width: 20px;
height: 20px;
}
}
++<<<<<<< HEAD
+
+ h3 {
+ font-size: 20px;
+ }
+
++=======
+
+ h3 {
+ font-size: 20px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.header-subtitle {
font-size: 13px;
max-width: 240px;
}
}
++<<<<<<< HEAD
+
+ .modal-content {
+ gap: 24px;
+ }
+
++=======
+
+ .modal-content {
+ gap: 24px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.swatches {
grid-template-columns: repeat(2, 1fr);
gap: 20px;
padding: 0 4px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.swatch {
width: 64px;
height: 64px;
}
++<<<<<<< HEAD
+
+ .custom {
+ padding: 20px;
+ }
+
++=======
+
+ .custom {
+ padding: 20px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.color-wheel-section {
flex-direction: column;
gap: 16px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.color-wheel {
width: 250px !important;
height: 125px !important;
}
++<<<<<<< HEAD
+
+ .validate-wheel-btn {
+ padding: 12px 18px;
+ font-size: 13px;
+
++=======
+
+ .validate-wheel-btn {
+ padding: 12px 18px;
+ font-size: 13px;
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-text {
font-size: 13px;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.input-group {
flex-direction: column;
gap: 12px;
align-items: stretch;
}
++<<<<<<< HEAD
+
+ .color-preview {
+ align-self: center;
+ }
+
++=======
+
+ .color-preview {
+ align-self: center;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.apply {
padding: 14px 24px;
font-size: 15px;
}
++<<<<<<< HEAD
+
+ .modal-footer {
+ padding: 24px 0;
+
++=======
+
+ .modal-footer {
+ padding: 24px 0;
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.cancel-btn {
padding: 12px 24px;
font-size: 14px;
@@@ -971,40 -982,40 +1415,72 @@@
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.swatch {
width: 56px;
height: 56px;
}
++<<<<<<< HEAD
+
+ .custom {
+ padding: 16px;
+ }
+
++=======
+
+ .custom {
+ padding: 16px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.color-wheel {
width: 200px !important;
height: 100px !important;
}
++<<<<<<< HEAD
+
+ .validate-wheel-btn {
+ padding: 10px 16px;
+ font-size: 12px;
+
+ .btn-text {
+ font-size: 12px;
+ }
+
++=======
+
+ .validate-wheel-btn {
+ padding: 10px 16px;
+ font-size: 12px;
+
+ .btn-text {
+ font-size: 12px;
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.btn-icon {
width: 14px;
height: 14px;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.hex {
font-size: 14px;
padding: 12px 14px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.apply {
padding: 12px 20px;
font-size: 14px;
diff --cc frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
index adb21c34,b6a30e0f..a691aab8
--- a/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
+++ b/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
@@@ -1,25 -1,28 +1,50 @@@
<template>
<div class="grid-organization-modal">
<div class="modal-header">
++<<<<<<< HEAD
+ <h3>Grid Organization</h3>
+ </div>
+
+ <div class="modal-content">
+ <div class="table-selector">
+ <h4>Select Table Size</h4>
+ <div class="table-grid">
+ <div
+ v-for="row in 12"
+ :key="`row-${row}`"
+ class="table-row"
+ >
+ <div
+ v-for="col in 12"
+ :key="`col-${col}`"
+ class="table-cell"
+ :class="{
+ 'hovered': isHovered(row, col),
+ 'selected': isSelected(row, col)
++=======
+ <div class="header-icon">
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="#fff">
+ <path
+ d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"
+ />
+ </svg>
+ </div>
+ <h3>Table creator</h3>
+ <p class="header-subtitle">Choose from predefined table layouts or create your own</p>
+ </div>
+
+ <div class="modal-content">
+ <div class="table-selector">
+ <div class="table-grid">
+ <div v-for="row in 12" :key="`row-${row}`" class="table-row">
+ <div
+ v-for="col in 12"
+ :key="`col-${col}`"
+ class="table-cell"
+ :class="{
+ hovered: isHovered(row, col),
+ selected: isSelected(row, col),
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
}"
@mouseenter="handleHover(row, col)"
@mouseleave="handleHoverLeave()"
@@@ -32,30 -35,19 +57,43 @@@
<span v-else>Hover to see table size</span>
</div>
</div>
++<<<<<<< HEAD
+
+ <div class="quick-presets">
+ <h4>Quick Presets</h4>
+ <div class="presets-grid">
+ <div
+ v-for="preset in gridPresets"
+ :key="preset.name"
+ class="preset-item"
+ @click="selectPreset(preset)"
+ >
+ <div class="preset-visual" :style="getPresetStyle(preset)">
+ <div
+ v-for="cell in preset.cells"
+ :key="cell.id"
+ class="preset-cell"
+ :style="getCellStyle(cell)"
+ ></div>
++=======
+
+ <div class="quick-presets">
+ <div class="presets-grid">
+ <div v-for="preset in gridPresets" :key="preset.name" class="preset-item" @click="selectPreset(preset)">
+ <div class="preset-visual" :style="getPresetStyle(preset)">
+ <div v-for="cell in preset.cells" :key="cell.id" class="preset-cell" :style="getCellStyle(cell)"></div>
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</div>
<span class="preset-name">{{ preset.name }}</span>
</div>
</div>
</div>
</div>
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="modal-footer">
<button class="cancel-btn" @click="closeModal">Cancel</button>
</div>
@@@ -63,8 -55,6 +101,11 @@@
</template>
<script setup lang="ts">
++<<<<<<< HEAD
+import { ref, computed } from 'vue';
+
++=======
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
const props = defineProps<{
onGridSelect: (gridMarkdown: string) => void;
}>();
@@@ -100,8 -90,8 +141,13 @@@ const gridPresets: GridPreset[] =
{ id: '1', col: 1, row: 1 },
{ id: '2', col: 2, row: 1 },
{ id: '3', col: 1, row: 2 },
++<<<<<<< HEAD
+ { id: '4', col: 2, row: 2 }
+ ]
++=======
+ { id: '4', col: 2, row: 2 },
+ ],
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
},
{
name: '3x2 Grid',
@@@ -113,8 -103,8 +159,13 @@@
{ id: '3', col: 3, row: 1 },
{ id: '4', col: 1, row: 2 },
{ id: '5', col: 2, row: 2 },
++<<<<<<< HEAD
+ { id: '6', col: 3, row: 2 }
+ ]
++=======
+ { id: '6', col: 3, row: 2 },
+ ],
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
},
{
name: '2x3 Grid',
@@@ -126,8 -116,8 +177,13 @@@
{ id: '3', col: 1, row: 2 },
{ id: '4', col: 2, row: 2 },
{ id: '5', col: 1, row: 3 },
++<<<<<<< HEAD
+ { id: '6', col: 2, row: 3 }
+ ]
++=======
+ { id: '6', col: 2, row: 3 },
+ ],
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
},
{
name: '3x3 Grid',
@@@ -142,8 -132,8 +198,13 @@@
{ id: '6', col: 3, row: 2 },
{ id: '7', col: 1, row: 3 },
{ id: '8', col: 2, row: 3 },
++<<<<<<< HEAD
+ { id: '9', col: 3, row: 3 }
+ ]
++=======
+ { id: '9', col: 3, row: 3 },
+ ],
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
},
{
@@@ -156,9 -146,9 +217,15 @@@
{ id: '3', col: 1, row: 2 },
{ id: '4', col: 2, row: 2 },
{ id: '5', col: 1, row: 3 },
++<<<<<<< HEAD
+ { id: '6', col: 2, row: 3 }
+ ]
+ }
++=======
+ { id: '6', col: 2, row: 3 },
+ ],
+ },
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
];
const getPresetStyle = (preset: GridPreset) => {
@@@ -168,7 -158,7 +235,11 @@@
gridTemplateRows: `repeat(${preset.rows}, 1fr)`,
gap: '2px',
width: '100%',
++<<<<<<< HEAD
+ height: '60px'
++=======
+ height: '60px',
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
};
};
@@@ -177,7 -167,7 +248,11 @@@ const getCellStyle = (cell: GridCell) =
gridColumn: cell.colspan ? `span ${cell.colspan}` : `span 1`,
gridRow: cell.rowspan ? `span ${cell.rowspan}` : `span 1`,
backgroundColor: 'var(--primary)',
++<<<<<<< HEAD
+ borderRadius: '2px'
++=======
+ borderRadius: '2px',
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
};
};
@@@ -212,31 -202,29 +287,55 @@@ const selectPreset = (preset: GridPrese
emit('close');
};
++<<<<<<< HEAD
+
+
+const generateGridMarkdown = (columns: number, rows: number): string => {
+ let markdown = '\n';
+
+ markdown += '|';
+ for (let i = 0; i < columns; i++) {
+ markdown += ' Column ' + (i + 1) + ' |';
+ }
+ markdown += '\n';
+
++=======
+ const generateGridMarkdown = (columns: number, rows: number): string => {
+ let markdown = '\n';
+
+ markdown += '|';
+ for (let i = 0; i < columns; i++) {
+ markdown += ' |';
+ }
+ markdown += '\n';
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
markdown += '|';
for (let i = 0; i < columns; i++) {
markdown += ' --- |';
}
markdown += '\n';
++<<<<<<< HEAD
+
+ for (let row = 0; row < rows; row++) {
+ markdown += '|';
+ for (let col = 0; col < columns; col++) {
+ markdown += ' Content ' + (row * columns + col + 1) + ' |';
+ }
+ markdown += '\n';
+ }
+
++=======
+
+ for (let row = 0; row < rows; row++) {
+ markdown += '|';
+ for (let col = 0; col < columns; col++) {
+ markdown += ' |';
+ }
+ markdown += '\n';
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
markdown += '\n';
return markdown;
};
@@@ -253,68 -241,68 +352,128 @@@ const closeModal = () =>
height: 100%;
display: flex;
flex-direction: column;
++<<<<<<< HEAD
+ overflow: hidden;
++=======
+ overflow: auto;
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
padding: 0 16px;
}
.modal-header {
display: flex;
++<<<<<<< HEAD
+ justify-content: center;
+ align-items: center;
+ padding: 24px 0 20px 0;
+ flex-shrink: 0;
+ position: relative;
+
+ h3 {
+ margin: 0;
+ font-size: 20px;
+ font-weight: 700;
+ color: var(--font-color-dark);
+ letter-spacing: -0.5px;
+ }
+
+ &::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 60px;
+ height: 3px;
+ background: linear-gradient(90deg, var(--primary), var(--primary-light, var(--primary)));
+ border-radius: 2px;
+ }
+}
+
+.modal-content {
+ flex: 1;
+ overflow: hidden;
++=======
+ flex-direction: column;
+ align-items: center;
+ padding: 24px 0 20px 0;
+ flex-shrink: 0;
+ text-align: center;
+
+ .header-icon {
+ width: 48px;
+ height: 48px;
+ background: linear-gradient(135deg, var(--primary), var(--primary-dark, var(--primary)));
+ border-radius: 16px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 16px;
+ color: white;
+
+ svg {
+ width: 24px;
+ height: 24px;
+ }
+ }
+
+ h3 {
+ margin: 0 0 8px 0;
+ font-size: 24px;
+ font-weight: 800;
+ color: var(--font-color-dark);
+ letter-spacing: -0.8px;
+ background: linear-gradient(135deg, var(--font-color-dark), var(--primary));
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ }
+
+ .header-subtitle {
+ margin: 0;
+ font-size: 14px;
+ color: var(--font-color-light);
+ font-weight: 500;
+ line-height: 1.4;
+ max-width: 280px;
+ }
+ }
+ .modal-content {
+ flex: 1;
+ overflow: auto;
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
display: flex;
flex-direction: column;
padding: 0;
gap: 32px;
}
++<<<<<<< HEAD
+.table-selector, .quick-presets {
+ margin-top: 8px;
+
+ h4 {
+ margin: 0 0 20px 0;
+ font-size: 18px;
+ font-weight: 600;
+ color: var(--font-color-dark);
+ display: flex;
+ align-items: center;
+ gap: 8px;
+
+ &::before {
+ content: '';
+ width: 4px;
+ height: 18px;
+ background: var(--primary);
+ border-radius: 2px;
+ }
+ }
++=======
+ .table-selector,
+ .quick-presets {
+ margin-top: 8px;
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
}
.table-grid {
@@@ -343,20 -331,20 +502,32 @@@
cursor: pointer;
transition: all 0.2s ease;
position: relative;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
background: var(--primary);
border-color: var(--primary);
transform: scale(1.1);
z-index: 2;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&.hovered {
background: var(--primary);
border-color: var(--primary);
opacity: 0.8;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&.selected {
background: var(--primary);
border-color: var(--primary);
@@@ -398,7 -386,7 +569,11 @@@
background: var(--bg-color-secondary);
position: relative;
overflow: hidden;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::before {
content: '';
position: absolute;
@@@ -410,23 -398,23 +585,39 @@@
transform: scaleX(0);
transition: transform 0.3s ease;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
border-color: var(--primary);
background: var(--bg-color);
transform: translateY(-4px);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
++<<<<<<< HEAD
+
+ &::before {
+ transform: scaleX(1);
+ }
+
++=======
+
+ &::before {
+ transform: scaleX(1);
+ }
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.preset-visual {
border-color: var(--primary);
box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.2);
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.preset-visual {
margin-bottom: 8px;
border: 2px solid var(--border-color);
@@@ -435,7 -423,7 +626,11 @@@
transition: all 0.3s ease;
position: relative;
height: 50px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&::after {
content: '';
position: absolute;
@@@ -445,14 -433,14 +640,22 @@@
pointer-events: none;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.preset-name {
font-size: 13px;
color: var(--font-color-dark);
font-weight: 600;
transition: color 0.3s ease;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover .preset-name {
color: var(--primary);
}
@@@ -464,7 -452,7 +667,11 @@@
justify-content: flex-end;
gap: 16px;
flex-shrink: 0;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.cancel-btn {
padding: 12px 24px;
border: 2px solid var(--border-color);
@@@ -475,14 -463,14 +682,22 @@@
font-size: 14px;
font-weight: 500;
transition: all 0.3s ease;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:hover {
background: var(--border-color);
border-color: var(--primary);
color: var(--primary);
transform: translateY(-1px);
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
&:active {
transform: translateY(0);
}
@@@ -494,18 -482,18 +709,30 @@@
grid-template-columns: repeat(8, 1fr);
gap: 1px;
max-width: 300px;
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.table-cell {
width: 14px;
height: 14px;
}
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.presets-grid {
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
gap: 12px;
}
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.table-info {
max-width: 300px;
font-size: 13px;
diff --cc frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
index 6135e6de,967401c5..53b25bb8
--- a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
@@@ -1,427 -1,402 +1,832 @@@
-<!-- eslint-disable vue/no-v-html -->
-<template>
- <div style="height: 100%; padding: 4px">
- <div class="editor-container">
- <Toolbar v-model="document" :minimal="minimal" @execute-action="exec" />
- <div style="display: flex; min-height: 0; padding: 6px; flex: 1; flex-direction: column; gap: 8px">
- <input v-if="!minimal" v-model="document.name" placeholder="Title" class="title" />
- <input v-if="!minimal" v-model="document.description" placeholder="Description" class="description" />
- <AppTagInput v-model="document.tags" style="margin-bottom: 10px" />
- <div ref="container" class="markdown">
- <div ref="editorContainer" class="codemirror-editor" style="border-right: 1px solid var(--border-color)" />
- <!-- eslint-disable-next-line vue/no-v-html -->
- <div
- v-if="showPreview"
- ref="markdownPreview"
- :class="['markdown-preview', `${usePreferences().get('theme')}-theme`]"
- style="position: relative"
- v-html="document.content_html"
- />
- </div>
- </div>
- </div>
- </div>
-</template>
-<script setup lang="ts">
-import { EditorView, keymap, highlightSpecialChars, drawSelection, lineNumbers, type KeyBinding } from '@codemirror/view';
-import { EditorState, Compartment } from '@codemirror/state';
-import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
-import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
-import { autocompletion } from '@codemirror/autocomplete';
-import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
-import { materialLight } from '@fsegurai/codemirror-theme-material-light';
-import { materialDark } from '@fsegurai/codemirror-theme-material-dark';
-import Toolbar from './Toolbar.vue';
-import ImageSelectorModal from './ImageSelectorModal.vue';
-import GridOrganizationModal from './GridOrganizationModal.vue';
-import ColorPickerModal from './ColorPickerModal.vue';
-
-import compile from '~/helpers/markdown';
-import type { Document } from '~/stores';
-import { useModal, Modal } from '~/composables/ModalBus';
-
-const props = defineProps<{ doc?: Partial<Document>; minimal?: boolean }>();
-
-const emit = defineEmits(['save', 'exit']);
-
-const editorContainer = ref<HTMLDivElement>();
-const markdownPreview = ref<HTMLDivElement>();
-const editorView = ref<EditorView | null>(null);
-const showPreview = ref(false);
-
-const document = ref<Partial<Document>>({
- ...props.doc,
- content_html: compile(props.doc?.content_markdown || ''),
-});
-
-function exec(action: string, payload?: string) {
- if (action === 'preview') return (showPreview.value = !showPreview.value);
- if (action === 'openColorPicker') return openColorModal();
- if (action === 'save') return save();
- if (action === 'goto') if (document.value.id) return useRouter().push(`/dashboard/docs/${document.value.id}`);
- if (action === 'image') return openImageSelector();
- if (action === 'gridOrganization') return openGridOrganization();
-
- if (!editorView.value) return;
-
- const view = editorView.value;
- const state = view.state;
-
- const { from, to } = state.selection.main;
- const selectedText = state.sliceDoc(from, to);
-
- let changes;
-
- switch (action) {
- case 'bold':
- changes = { from, to, insert: `**${selectedText}**` };
- break;
- case 'italic':
- changes = { from, to, insert: `*${selectedText}*` };
- break;
- case 'underline':
- changes = { from, to, insert: `__${selectedText}__` };
- break;
- case 'strike':
- changes = { from, to, insert: `~~${selectedText}~~` };
- break;
- case 'link':
- changes = { from, to, insert: `[](${selectedText})` };
- break;
- case 'code':
- changes = { from, to, insert: `\`${selectedText}\`` };
- break;
- case 'quote':
- changes = { from, to, insert: `> ${selectedText}\n` };
- break;
- case 'list':
- changes = { from, to, insert: `- ${selectedText}\n` };
- break;
- case 'orderedList':
- changes = { from, to, insert: `1. ${selectedText}\n` };
- break;
- case 'color': {
- const color = String(payload || '').trim();
- if (!color) return;
- const value = selectedText || 'text';
- const insert = `{color:${color}}(${value})`;
- changes = { from, to, insert };
- break;
- }
- }
- view.dispatch({
- changes,
- selection: { anchor: from + 2, head: to + 2 },
- });
-
- view.focus();
-}
-
-function openColorModal() {
- const modalManager = useModal();
- modalManager.add(new Modal(shallowRef(ColorPickerModal), { onColorSelect: handleColorSelect }, () => {}, false));
-}
-
-function handleColorSelect(color: string) {
- exec('color', color);
-}
-
-function openImageSelector() {
- const modalManager = useModal();
- modalManager.add(new Modal(shallowRef(ImageSelectorModal), { onImageSelect: handleImageSelect }, () => {}, true));
-}
-
-function openGridOrganization() {
- const modalManager = useModal();
- modalManager.add(new Modal(shallowRef(GridOrganizationModal), { onGridSelect: handleGridSelect }, () => {}, false));
-}
-
-function handleImageSelect(imageUrl: string, altText: string) {
- if (!editorView.value) return;
-
- const view = editorView.value;
- const state = view.state;
- const { from, to } = state.selection.main;
- const selectedText = state.sliceDoc(from, to);
-
- const alt = selectedText || altText;
- const insert = `![${alt}](${imageUrl})`;
-
- view.dispatch({
- changes: { from, to, insert },
- selection: { anchor: from + insert.length, head: from + insert.length },
- });
-
- view.focus();
-}
-
-function handleGridSelect(gridMarkdown: string) {
- if (!editorView.value) return;
-
- const view = editorView.value;
- const state = view.state;
- const { from, to } = state.selection.main;
-
- view.dispatch({
- changes: { from, to, insert: gridMarkdown },
- selection: { anchor: from + gridMarkdown.length, head: from + gridMarkdown.length },
- });
-
- view.focus();
-}
-const snippets: Record<string, string> = {
- '!blue': ':::blue\n$0\n:::',
- '!green': ':::green\n$0\n:::',
- '!yellow': ':::yellow\n$0\n:::',
- '!grey': ':::grey\n$0\n:::',
- '!details': ':::details\n$0\n:::',
- '!center': ':::center\n$0\n:::',
- '!m': '$$0$',
- '!property': ':::property $0\n\n:::',
- '!warning': ':::warning $0\n\n:::',
-};
-const snippetListener = EditorView.updateListener.of(update => {
- if (!update.docChanged || !editorView.value) return;
-
- const { state, transactions } = update;
- const lastTransaction = transactions[0];
-
- const changes = lastTransaction!.changes;
-
- // Ne gĂšre que les insertions simples
- let hasInsertion = false;
- changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
- if (inserted.length > 0) {
- hasInsertion = true;
- }
- });
- if (!hasInsertion) return;
-
- // VĂ©rifie si on vient d’insĂ©rer un mot-clĂ©
- const cursorPos = state.selection.main.head;
- const line = state.doc.lineAt(cursorPos);
- const textBefore = line.text.slice(0, cursorPos - line.from);
-
- const match = Object.keys(snippets).find(key => textBefore.endsWith(key));
- if (!match) return;
-
- const start = cursorPos - match.length;
- const snippet = snippets[match];
-
- // remplace $0 par un curseur
- const [before, after] = snippet!.split('$0');
- const newText = (before || '') + after;
-
- const view = editorView.value;
- view.dispatch({
- changes: { from: start, to: cursorPos, insert: newText },
- selection: {
- anchor: start + (before?.length || 0),
- },
- });
-});
-const markdownKeysmap: readonly KeyBinding[] = [
- {
- key: 'Mod-b',
- run: () => {
- exec('bold');
- return true;
- },
- },
- {
- key: 'Mod-i',
- run: () => {
- exec('italic');
- return true;
- },
- },
- {
- key: 'Mod-u',
- run: () => {
- exec('underline');
- return true;
- },
- },
- {
- key: 'Mod-k',
- run: () => {
- exec('image');
- return true;
- },
- },
- {
- key: 'Mod-l',
- run: () => {
- exec('link');
- return true;
- },
- },
-];
-
-const themeCompartment = new Compartment();
-
-watch(useColorMode(), mode => {
- if (!editorView.value) return;
- editorView.value.dispatch({
- effects: themeCompartment.reconfigure(mode.value === 'dark' ? materialDark : materialLight),
- });
-});
-const updateListener = EditorView.updateListener.of(v => {
- if (v.docChanged) {
- const content = v.state.doc.toString();
- document.value.content_markdown = content;
- document.value.content_html = compile(content);
- }
-});
-const state = EditorState.create({
- doc: document.value.content_markdown || '',
- extensions: [
- lineNumbers(),
- highlightSpecialChars(),
- history(),
- drawSelection(),
- autocompletion(),
- keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, indentWithTab, ...markdownKeysmap]),
- markdown({ base: markdownLanguage }),
- updateListener,
- snippetListener,
- themeCompartment.of(useColorMode().value === 'dark' ? materialDark : materialLight),
- highlightSelectionMatches({}),
- EditorView.lineWrapping,
- EditorState.allowMultipleSelections.of(true),
- ],
-});
-onMounted(() => {
- if (!editorContainer.value) return;
- editorView.value = new EditorView({
- state,
- parent: editorContainer.value,
- });
- editorView.value.scrollDOM.addEventListener('scroll', syncScroll);
- window.addEventListener('keydown', handleGlobalKeys);
-});
-
-onBeforeUnmount(() => {
- if (editorView.value) editorView.value.destroy();
- editorView.value?.scrollDOM.removeEventListener('scroll', syncScroll);
- window.removeEventListener('keydown', handleGlobalKeys);
-});
-
-function handleGlobalKeys(e: KeyboardEvent) {
- if ((e.ctrlKey || e.metaKey) && e.key === 's') {
- e.preventDefault();
- save();
- }
- if ((e.ctrlKey || e.metaKey) && e.key === 'p') {
- e.preventDefault();
- showPreview.value = !showPreview.value;
- }
-
- if (e.key === 'Escape') {
- emit('exit');
- }
-}
-
-function syncScroll() {
- if (!editorView.value?.scrollDOM || !markdownPreview.value) return;
- const scrollPercentage = editorView.value.scrollDOM.scrollTop / (editorView.value.scrollDOM.scrollHeight - editorView.value.scrollDOM.clientHeight);
- markdownPreview.value.scrollTop = scrollPercentage * (markdownPreview.value.scrollHeight - markdownPreview.value.clientHeight);
-}
-
-function save() {
- const content = editorView.value?.state.doc.toString() || '';
- document.value.content_markdown = content;
- document.value.content_html = compile(content);
- emit('save', document.value);
-}
-</script>
-
-<style scoped lang="scss">
-.markdown {
- display: flex;
- min-height: 0; /* permet aux enfants flexibles de ne pas déborder */
- flex: 1;
- gap: 8px;
-}
-
-.editor-container {
- display: flex;
- width: 100%;
- height: 100%;
- flex-direction: column;
-}
-
-.codemirror-editor {
- flex: 1;
- overflow: auto;
-}
-
-.editor-container:deep(.cm-editor) {
- height: 100%;
-}
-/* stylelint-disable */
-.editor-container:deep(.cm-selectionBackground) {
- background-color: var(--selection-color) !important;
-}
-
-.markdown-preview {
- height: 100%;
- padding: 1rem;
- background: var(--bg-color);
- flex: 1;
- overflow: auto;
-}
-
-input {
- border: none;
- outline: none;
-}
-
-.title {
- padding: 6px 10px;
- font-size: 1.5rem;
- font-weight: 600;
-}
-
-.description {
- padding: 4px 10px;
- font-size: 1.1rem;
- font-weight: 500;
-}
-
-.image-selector-overlay {
- position: fixed;
- z-index: 99999;
- display: flex;
- background: rgb(0 0 0 / 45%);
- align-items: center;
- inset: 0;
- justify-content: center;
- padding: 20px;
-}
-</style>
++<<<<<<< HEAD
+<template>
+ <div style="height: 100%; padding: 4px">
+ <div class="editor-container">
+ <Toolbar v-model="document" :minimal="minimal" @execute-action="exec" />
+ <div style="display: flex; min-height: 0; padding: 6px; flex: 1; flex-direction: column; gap: 8px">
+ <input v-if="!minimal" v-model="document.name" placeholder="Title" class="title" />
+ <input v-if="!minimal" v-model="document.description" placeholder="Description" class="description" />
+ <AppTagInput v-model="document.tags" style="margin-bottom: 10px" />
+ <div ref="container" class="markdown">
+ <div ref="editorContainer" class="codemirror-editor" style="border-right: 1px solid var(--border-color)" />
+ <!-- eslint-disable-next-line vue/no-v-html -->
+ <div v-if="showPreview" ref="markdownPreview" :class="['markdown-preview', `${usePreferences().get('theme')}-theme`]" style="position: relative" v-html="document.content_html" />
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+<script setup lang="ts">
+import { EditorView, keymap, highlightSpecialChars, drawSelection, lineNumbers, type KeyBinding } from '@codemirror/view';
+import { EditorState, Compartment } from '@codemirror/state';
+import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
+import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
+import { autocompletion } from '@codemirror/autocomplete';
+import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
+import { materialLight } from '@fsegurai/codemirror-theme-material-light';
+import { materialDark } from '@fsegurai/codemirror-theme-material-dark';
+import Toolbar from './Toolbar.vue';
+import ImageSelectorModal from './ImageSelectorModal.vue';
+import GridOrganizationModal from './GridOrganizationModal.vue';
+import ColorPickerModal from './ColorPickerModal.vue';
+
+import compile from '~/helpers/markdown';
+import type { Document } from '~/stores';
+import { useModal, Modal } from '~/composables/ModalBus';
+
+const props = defineProps<{ doc?: Partial<Document>; minimal?: boolean }>();
+
+const emit = defineEmits(['save', 'exit']);
+
+const editorContainer = ref<HTMLDivElement>();
+const markdownPreview = ref<HTMLDivElement>();
+const editorView = ref<EditorView | null>(null);
+const showPreview = ref(false);
+
+const document = ref<Partial<Document>>({
+ ...props.doc,
+ content_html: compile(props.doc?.content_markdown || ''),
+});
+
+function exec(action: string, payload?: string) {
+ if (action === 'preview') return (showPreview.value = !showPreview.value);
+ if (action === 'openColorPicker') return openColorModal();
+ if (action === 'save') return save();
+ if (action === 'goto') if (document.value.id) return useRouter().push(`/dashboard/docs/${document.value.id}`);
+ if (action === 'image') return openImageSelector();
+ if (action === 'gridOrganization') return openGridOrganization();
+ if (action === 'insertText') return insertText(payload || '');
+
+ if (!editorView.value) return;
+
+ const view = editorView.value;
+ const state = view.state;
+
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+
+ let changes;
+
+ switch (action) {
+ case 'bold':
+ changes = { from, to, insert: `**${selectedText}**` };
+ break;
+ case 'italic':
+ changes = { from, to, insert: `*${selectedText}*` };
+ break;
+ case 'underline':
+ changes = { from, to, insert: `__${selectedText}__` };
+ break;
+ case 'strike':
+ changes = { from, to, insert: `~~${selectedText}~~` };
+ break;
+ case 'link':
+ changes = { from, to, insert: `[](${selectedText})` };
+ break;
+ case 'code':
+ changes = { from, to, insert: `\`${selectedText}\`` };
+ break;
+ case 'quote':
+ changes = { from, to, insert: `> ${selectedText}\n` };
+ break;
+ case 'list':
+ changes = { from, to, insert: `- ${selectedText}\n` };
+ break;
+ case 'orderedList':
+ changes = { from, to, insert: `1. ${selectedText}\n` };
+ break;
+ case 'color': {
+ const color = String(payload || '').trim();
+ if (!color) return;
+ const value = selectedText || 'text';
+ const insert = `{color:${color}}(${value})`;
+ changes = { from, to, insert };
+ break;
+ }
+ }
+ view.dispatch({
+ changes,
+ selection: { anchor: from + 2, head: to + 2 },
+ });
+
+ view.focus();
+}
+
+function insertText(text: string) {
+ if (!editorView.value || !text) return;
+
+ const view = editorView.value;
+ const state = view.state;
+ const { from, to } = state.selection.main;
+
+ view.dispatch({
+ changes: { from, to, insert: text },
+ selection: { anchor: from + text.length, head: from + text.length },
+ });
+
+ view.focus();
+}
+
+function openColorModal() {
+ const modalManager = useModal();
+ // Fermer tous les modals existants avant d'en ouvrir un nouveau
+ while (modalManager.modals.value.length > 0) {
+ modalManager.close(modalManager.modals.value[0]);
+ }
+ modalManager.add(new Modal(shallowRef(ColorPickerModal), { onColorSelect: handleColorSelect }, () => {}, true));
+}
+
+function handleColorSelect(color: string) {
+ exec('color', color);
+}
+
+function openImageSelector() {
+ const modalManager = useModal();
+ console.log('Modals avant ouverture:', modalManager.modals.value.length);
+ // Fermer tous les modals existants avant d'en ouvrir un nouveau
+ while (modalManager.modals.value.length > 0) {
+ modalManager.close(modalManager.modals.value[0]);
+ }
+ modalManager.add(new Modal(shallowRef(ImageSelectorModal), { onImageSelect: handleImageSelect }, () => {}, true));
+ console.log('Modals aprĂšs ouverture:', modalManager.modals.value.length);
+}
+
+function openGridOrganization() {
+ const modalManager = useModal();
+ // Fermer tous les modals existants avant d'en ouvrir un nouveau
+ while (modalManager.modals.value.length > 0) {
+ modalManager.close(modalManager.modals.value[0]);
+ }
+ modalManager.add(new Modal(shallowRef(GridOrganizationModal), { onGridSelect: handleGridSelect }, () => {}, true));
+}
+
+function handleImageSelect(imageUrl: string, altText: string) {
+ if (!editorView.value) return;
+
+ const view = editorView.value;
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+
+ const alt = selectedText || altText;
+ const insert = `![${alt}](${imageUrl})`;
+
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + insert.length, head: from + insert.length },
+ });
+
+ view.focus();
+}
+
+function handleGridSelect(gridMarkdown: string) {
+ if (!editorView.value) return;
+
+ const view = editorView.value;
+ const state = view.state;
+ const { from, to } = state.selection.main;
+
+ view.dispatch({
+ changes: { from, to, insert: gridMarkdown },
+ selection: { anchor: from + gridMarkdown.length, head: from + gridMarkdown.length },
+ });
+
+ view.focus();
+}
+const snippets: Record<string, string> = {
+ '!blue': ':::blue\n$0\n:::',
+ '!green': ':::green\n$0\n:::',
+ '!yellow': ':::yellow\n$0\n:::',
+ '!grey': ':::grey\n$0\n:::',
+ '!details': ':::details\n$0\n:::',
+ '!center': ':::center\n$0\n:::',
+ '!m': '$$0$',
+ '!property': ':::property $0\n\n:::',
+ '!warning': ':::warning $0\n\n:::',
+};
+const snippetListener = EditorView.updateListener.of(update => {
+ if (!update.docChanged || !editorView.value) return;
+
+ const { state, transactions } = update;
+ const lastTransaction = transactions[0];
+
+ const changes = lastTransaction!.changes;
+
+ // Ne gĂšre que les insertions simples
+ let hasInsertion = false;
+ changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
+ if (inserted.length > 0) {
+ hasInsertion = true;
+ }
+ });
+ if (!hasInsertion) return;
+
+ // VĂ©rifie si on vient d’insĂ©rer un mot-clĂ©
+ const cursorPos = state.selection.main.head;
+ const line = state.doc.lineAt(cursorPos);
+ const textBefore = line.text.slice(0, cursorPos - line.from);
+
+ const match = Object.keys(snippets).find(key => textBefore.endsWith(key));
+ if (!match) return;
+
+ const start = cursorPos - match.length;
+ const snippet = snippets[match];
+
+ // remplace $0 par un curseur
+ const [before, after] = snippet!.split('$0');
+ const newText = (before || '') + after;
+
+ const view = editorView.value;
+ view.dispatch({
+ changes: { from: start, to: cursorPos, insert: newText },
+ selection: {
+ anchor: start + (before?.length || 0),
+ },
+ });
+});
+const markdownKeysmap: readonly KeyBinding[] = [
+ {
+ key: 'Mod-b',
+ run: () => {
+ exec('bold');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-i',
+ run: () => {
+ exec('italic');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-u',
+ run: () => {
+ exec('underline');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-k',
+ run: () => {
+ exec('image');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-l',
+ run: () => {
+ exec('link');
+ return true;
+ },
+ },
+];
+
+const themeCompartment = new Compartment();
+
+watch(useColorMode(), mode => {
+ if (!editorView.value) return;
+ editorView.value.dispatch({
+ effects: themeCompartment.reconfigure(mode.value === 'dark' ? materialDark : materialLight),
+ });
+});
+const updateListener = EditorView.updateListener.of(v => {
+ if (v.docChanged) {
+ const content = v.state.doc.toString();
+ document.value.content_markdown = content;
+ document.value.content_html = compile(content);
+ }
+});
+const state = EditorState.create({
+ doc: document.value.content_markdown || '',
+ extensions: [
+ lineNumbers(),
+ highlightSpecialChars(),
+ history(),
+ drawSelection(),
+ autocompletion(),
+ // @ts-expect-error types error
+ keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, indentWithTab, ...markdownKeysmap]),
+ markdown({ base: markdownLanguage }),
+ updateListener,
+ snippetListener,
+ themeCompartment.of(useColorMode().value === 'dark' ? materialDark : materialLight),
+ highlightSelectionMatches({}),
+ EditorView.lineWrapping,
+ EditorState.allowMultipleSelections.of(true),
+ ],
+});
+onMounted(() => {
+ if (!editorContainer.value) return;
+ editorView.value = new EditorView({
+ state,
+ parent: editorContainer.value,
+ });
+ editorView.value.scrollDOM.addEventListener('scroll', syncScroll);
+ window.addEventListener('keydown', handleGlobalKeys);
+});
+
+onBeforeUnmount(() => {
+ if (editorView.value) editorView.value.destroy();
+ editorView.value?.scrollDOM.removeEventListener('scroll', syncScroll);
+ window.removeEventListener('keydown', handleGlobalKeys);
+});
+
+function handleGlobalKeys(e: KeyboardEvent) {
+ if ((e.ctrlKey || e.metaKey) && e.key === 's') {
+ e.preventDefault();
+ save();
+ }
+ if ((e.ctrlKey || e.metaKey) && e.key === 'p') {
+ e.preventDefault();
+ showPreview.value = !showPreview.value;
+ }
+
+ if (e.key === 'Escape') {
+ emit('exit');
+ }
+}
+
+function syncScroll() {
+ if (!editorView.value?.scrollDOM || !markdownPreview.value) return;
+ const scrollPercentage = editorView.value.scrollDOM.scrollTop / (editorView.value.scrollDOM.scrollHeight - editorView.value.scrollDOM.clientHeight);
+ markdownPreview.value.scrollTop = scrollPercentage * (markdownPreview.value.scrollHeight - markdownPreview.value.clientHeight);
+}
+
+function save() {
+ const content = editorView.value?.state.doc.toString() || '';
+ document.value.content_markdown = content;
+ document.value.content_html = compile(content);
+ emit('save', document.value);
+}
+</script>
+
+<style scoped lang="scss">
+.markdown {
+ display: flex;
+ min-height: 0; /* permet aux enfants flexibles de ne pas déborder */
+ flex: 1;
+ gap: 8px;
+}
+
+.editor-container {
+ display: flex;
+ width: 100%;
+ height: 100%;
+ flex-direction: column;
+}
+
+.codemirror-editor {
+ flex: 1;
+ overflow: auto;
+}
+
+.editor-container:deep(.cm-editor) {
+ height: 100%;
+}
+/* stylelint-disable */
+.editor-container:deep(.cm-selectionBackground) {
+ background-color: var(--selection-color) !important;
+}
+
+.markdown-preview {
+ height: 100%;
+ padding: 1rem;
+ background: var(--bg-color);
+ flex: 1;
+ overflow: auto;
+}
+
+input {
+ border: none;
+ outline: none;
+}
+
+.title {
+ padding: 6px 10px;
+ font-size: 1.5rem;
+ font-weight: 600;
+}
+
+.description {
+ padding: 4px 10px;
+ font-size: 1.1rem;
+ font-weight: 500;
+}
+
+
+.image-selector-overlay {
+ position: fixed;
+ z-index: 99999;
+ display: flex;
+ background: rgb(0 0 0 / 45%);
+ align-items: center;
+ inset: 0;
+ justify-content: center;
+ padding: 20px;
+}
+</style>
++=======
++<!-- eslint-disable vue/no-v-html -->
++<template>
++ <div style="height: 100%; padding: 4px">
++ <div class="editor-container">
++ <Toolbar v-model="document" :minimal="minimal" @execute-action="exec" />
++ <div style="display: flex; min-height: 0; padding: 6px; flex: 1; flex-direction: column; gap: 8px">
++ <input v-if="!minimal" v-model="document.name" placeholder="Title" class="title" />
++ <input v-if="!minimal" v-model="document.description" placeholder="Description" class="description" />
++ <AppTagInput v-model="document.tags" style="margin-bottom: 10px" />
++ <div ref="container" class="markdown">
++ <div ref="editorContainer" class="codemirror-editor" style="border-right: 1px solid var(--border-color)" />
++ <!-- eslint-disable-next-line vue/no-v-html -->
++ <div
++ v-if="showPreview"
++ ref="markdownPreview"
++ :class="['markdown-preview', `${usePreferences().get('theme')}-theme`]"
++ style="position: relative"
++ v-html="document.content_html"
++ />
++ </div>
++ </div>
++ </div>
++ </div>
++</template>
++<script setup lang="ts">
++import { EditorView, keymap, highlightSpecialChars, drawSelection, lineNumbers, type KeyBinding } from '@codemirror/view';
++import { EditorState, Compartment } from '@codemirror/state';
++import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
++import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
++import { autocompletion } from '@codemirror/autocomplete';
++import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
++import { materialLight } from '@fsegurai/codemirror-theme-material-light';
++import { materialDark } from '@fsegurai/codemirror-theme-material-dark';
++import Toolbar from './Toolbar.vue';
++import ImageSelectorModal from './ImageSelectorModal.vue';
++import GridOrganizationModal from './GridOrganizationModal.vue';
++import ColorPickerModal from './ColorPickerModal.vue';
++
++import compile from '~/helpers/markdown';
++import type { Document } from '~/stores';
++import { useModal, Modal } from '~/composables/ModalBus';
++
++const props = defineProps<{ doc?: Partial<Document>; minimal?: boolean }>();
++
++const emit = defineEmits(['save', 'exit']);
++
++const editorContainer = ref<HTMLDivElement>();
++const markdownPreview = ref<HTMLDivElement>();
++const editorView = ref<EditorView | null>(null);
++const showPreview = ref(false);
++
++const document = ref<Partial<Document>>({
++ ...props.doc,
++ content_html: compile(props.doc?.content_markdown || ''),
++});
++
++function exec(action: string, payload?: string) {
++ if (action === 'preview') return (showPreview.value = !showPreview.value);
++ if (action === 'openColorPicker') return openColorModal();
++ if (action === 'save') return save();
++ if (action === 'goto') if (document.value.id) return useRouter().push(`/dashboard/docs/${document.value.id}`);
++ if (action === 'image') return openImageSelector();
++ if (action === 'gridOrganization') return openGridOrganization();
++
++ if (!editorView.value) return;
++
++ const view = editorView.value;
++ const state = view.state;
++
++ const { from, to } = state.selection.main;
++ const selectedText = state.sliceDoc(from, to);
++
++ let changes;
++
++ switch (action) {
++ case 'bold':
++ changes = { from, to, insert: `**${selectedText}**` };
++ break;
++ case 'italic':
++ changes = { from, to, insert: `*${selectedText}*` };
++ break;
++ case 'underline':
++ changes = { from, to, insert: `__${selectedText}__` };
++ break;
++ case 'strike':
++ changes = { from, to, insert: `~~${selectedText}~~` };
++ break;
++ case 'link':
++ changes = { from, to, insert: `[](${selectedText})` };
++ break;
++ case 'code':
++ changes = { from, to, insert: `\`${selectedText}\`` };
++ break;
++ case 'quote':
++ changes = { from, to, insert: `> ${selectedText}\n` };
++ break;
++ case 'list':
++ changes = { from, to, insert: `- ${selectedText}\n` };
++ break;
++ case 'orderedList':
++ changes = { from, to, insert: `1. ${selectedText}\n` };
++ break;
++ case 'color': {
++ const color = String(payload || '').trim();
++ if (!color) return;
++ const value = selectedText || 'text';
++ const insert = `{color:${color}}(${value})`;
++ changes = { from, to, insert };
++ break;
++ }
++ }
++ view.dispatch({
++ changes,
++ selection: { anchor: from + 2, head: to + 2 },
++ });
++
++ view.focus();
++}
++
++function openColorModal() {
++ const modalManager = useModal();
++ modalManager.add(new Modal(shallowRef(ColorPickerModal), { onColorSelect: handleColorSelect }, () => {}, false));
++}
++
++function handleColorSelect(color: string) {
++ exec('color', color);
++}
++
++function openImageSelector() {
++ const modalManager = useModal();
++ modalManager.add(new Modal(shallowRef(ImageSelectorModal), { onImageSelect: handleImageSelect }, () => {}, true));
++}
++
++function openGridOrganization() {
++ const modalManager = useModal();
++ modalManager.add(new Modal(shallowRef(GridOrganizationModal), { onGridSelect: handleGridSelect }, () => {}, false));
++}
++
++function handleImageSelect(imageUrl: string, altText: string) {
++ if (!editorView.value) return;
++
++ const view = editorView.value;
++ const state = view.state;
++ const { from, to } = state.selection.main;
++ const selectedText = state.sliceDoc(from, to);
++
++ const alt = selectedText || altText;
++ const insert = `![${alt}](${imageUrl})`;
++
++ view.dispatch({
++ changes: { from, to, insert },
++ selection: { anchor: from + insert.length, head: from + insert.length },
++ });
++
++ view.focus();
++}
++
++function handleGridSelect(gridMarkdown: string) {
++ if (!editorView.value) return;
++
++ const view = editorView.value;
++ const state = view.state;
++ const { from, to } = state.selection.main;
++
++ view.dispatch({
++ changes: { from, to, insert: gridMarkdown },
++ selection: { anchor: from + gridMarkdown.length, head: from + gridMarkdown.length },
++ });
++
++ view.focus();
++}
++const snippets: Record<string, string> = {
++ '!blue': ':::blue\n$0\n:::',
++ '!green': ':::green\n$0\n:::',
++ '!yellow': ':::yellow\n$0\n:::',
++ '!grey': ':::grey\n$0\n:::',
++ '!details': ':::details\n$0\n:::',
++ '!center': ':::center\n$0\n:::',
++ '!m': '$$0$',
++ '!property': ':::property $0\n\n:::',
++ '!warning': ':::warning $0\n\n:::',
++};
++const snippetListener = EditorView.updateListener.of(update => {
++ if (!update.docChanged || !editorView.value) return;
++
++ const { state, transactions } = update;
++ const lastTransaction = transactions[0];
++
++ const changes = lastTransaction!.changes;
++
++ // Ne gĂšre que les insertions simples
++ let hasInsertion = false;
++ changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
++ if (inserted.length > 0) {
++ hasInsertion = true;
++ }
++ });
++ if (!hasInsertion) return;
++
++ // VĂ©rifie si on vient d’insĂ©rer un mot-clĂ©
++ const cursorPos = state.selection.main.head;
++ const line = state.doc.lineAt(cursorPos);
++ const textBefore = line.text.slice(0, cursorPos - line.from);
++
++ const match = Object.keys(snippets).find(key => textBefore.endsWith(key));
++ if (!match) return;
++
++ const start = cursorPos - match.length;
++ const snippet = snippets[match];
++
++ // remplace $0 par un curseur
++ const [before, after] = snippet!.split('$0');
++ const newText = (before || '') + after;
++
++ const view = editorView.value;
++ view.dispatch({
++ changes: { from: start, to: cursorPos, insert: newText },
++ selection: {
++ anchor: start + (before?.length || 0),
++ },
++ });
++});
++const markdownKeysmap: readonly KeyBinding[] = [
++ {
++ key: 'Mod-b',
++ run: () => {
++ exec('bold');
++ return true;
++ },
++ },
++ {
++ key: 'Mod-i',
++ run: () => {
++ exec('italic');
++ return true;
++ },
++ },
++ {
++ key: 'Mod-u',
++ run: () => {
++ exec('underline');
++ return true;
++ },
++ },
++ {
++ key: 'Mod-k',
++ run: () => {
++ exec('image');
++ return true;
++ },
++ },
++ {
++ key: 'Mod-l',
++ run: () => {
++ exec('link');
++ return true;
++ },
++ },
++];
++
++const themeCompartment = new Compartment();
++
++watch(useColorMode(), mode => {
++ if (!editorView.value) return;
++ editorView.value.dispatch({
++ effects: themeCompartment.reconfigure(mode.value === 'dark' ? materialDark : materialLight),
++ });
++});
++const updateListener = EditorView.updateListener.of(v => {
++ if (v.docChanged) {
++ const content = v.state.doc.toString();
++ document.value.content_markdown = content;
++ document.value.content_html = compile(content);
++ }
++});
++const state = EditorState.create({
++ doc: document.value.content_markdown || '',
++ extensions: [
++ lineNumbers(),
++ highlightSpecialChars(),
++ history(),
++ drawSelection(),
++ autocompletion(),
++ keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, indentWithTab, ...markdownKeysmap]),
++ markdown({ base: markdownLanguage }),
++ updateListener,
++ snippetListener,
++ themeCompartment.of(useColorMode().value === 'dark' ? materialDark : materialLight),
++ highlightSelectionMatches({}),
++ EditorView.lineWrapping,
++ EditorState.allowMultipleSelections.of(true),
++ ],
++});
++onMounted(() => {
++ if (!editorContainer.value) return;
++ editorView.value = new EditorView({
++ state,
++ parent: editorContainer.value,
++ });
++ editorView.value.scrollDOM.addEventListener('scroll', syncScroll);
++ window.addEventListener('keydown', handleGlobalKeys);
++});
++
++onBeforeUnmount(() => {
++ if (editorView.value) editorView.value.destroy();
++ editorView.value?.scrollDOM.removeEventListener('scroll', syncScroll);
++ window.removeEventListener('keydown', handleGlobalKeys);
++});
++
++function handleGlobalKeys(e: KeyboardEvent) {
++ if ((e.ctrlKey || e.metaKey) && e.key === 's') {
++ e.preventDefault();
++ save();
++ }
++ if ((e.ctrlKey || e.metaKey) && e.key === 'p') {
++ e.preventDefault();
++ showPreview.value = !showPreview.value;
++ }
++
++ if (e.key === 'Escape') {
++ emit('exit');
++ }
++}
++
++function syncScroll() {
++ if (!editorView.value?.scrollDOM || !markdownPreview.value) return;
++ const scrollPercentage = editorView.value.scrollDOM.scrollTop / (editorView.value.scrollDOM.scrollHeight - editorView.value.scrollDOM.clientHeight);
++ markdownPreview.value.scrollTop = scrollPercentage * (markdownPreview.value.scrollHeight - markdownPreview.value.clientHeight);
++}
++
++function save() {
++ const content = editorView.value?.state.doc.toString() || '';
++ document.value.content_markdown = content;
++ document.value.content_html = compile(content);
++ emit('save', document.value);
++}
++</script>
++
++<style scoped lang="scss">
++.markdown {
++ display: flex;
++ min-height: 0; /* permet aux enfants flexibles de ne pas déborder */
++ flex: 1;
++ gap: 8px;
++}
++
++.editor-container {
++ display: flex;
++ width: 100%;
++ height: 100%;
++ flex-direction: column;
++}
++
++.codemirror-editor {
++ flex: 1;
++ overflow: auto;
++}
++
++.editor-container:deep(.cm-editor) {
++ height: 100%;
++}
++/* stylelint-disable */
++.editor-container:deep(.cm-selectionBackground) {
++ background-color: var(--selection-color) !important;
++}
++
++.markdown-preview {
++ height: 100%;
++ padding: 1rem;
++ background: var(--bg-color);
++ flex: 1;
++ overflow: auto;
++}
++
++input {
++ border: none;
++ outline: none;
++}
++
++.title {
++ padding: 6px 10px;
++ font-size: 1.5rem;
++ font-weight: 600;
++}
++
++.description {
++ padding: 4px 10px;
++ font-size: 1.1rem;
++ font-weight: 500;
++}
++
++.image-selector-overlay {
++ position: fixed;
++ z-index: 99999;
++ display: flex;
++ background: rgb(0 0 0 / 45%);
++ align-items: center;
++ inset: 0;
++ justify-content: center;
++ padding: 20px;
++}
++</style>
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
diff --cc frontend/app/components/MarkdownEditor/Toolbar.vue
index fef2886d,e36f22f7..f6ec40a3
--- a/frontend/app/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue
@@@ -1,203 -1,198 +1,404 @@@
-<template>
- <div class="toolbar">
- <!-- eslint-disable-next-line vue/no-v-html -->
- <button v-for="item in toolbar" :key="item.name" :title="item.name" class="btn" @click="emitAction(item.action)" v-html="item.icon" />
- <div class="color-picker" />
- <AppSelect v-if="!minimal" v-model="localValue.accessibility" :items="accessibilities" placeholder="Access" size="100px" class="entry" />
- <AppSelect v-if="!minimal" v-model="localValue.category" :items="categories" placeholder="Select category" size="300px" class="entry" />
- <AppHint text="Tags has been moved down" />
- <button class="help" @click="openModal">
- <Icon name="help" :big="true" fill="var(--font-color-light)" />
- </button>
- </div>
-</template>
-
-<script setup lang="ts">
-import type { Document } from '~/stores';
-import ModalSyntax from './ModalSyntax.vue';
-
-const props = defineProps<{
- modelValue: Partial<Document>;
- minimal?: boolean;
-}>();
-
-const emit = defineEmits<{
- (e: 'update:modelValue', value: Partial<Document>): void;
- (e: 'execute-action', action: string): void;
-}>();
-
-const localValue = computed({
- get: () => props.modelValue,
- set: val => emit('update:modelValue', val),
-});
-
-const emitAction = (action: string) => emit('execute-action', action);
-
-const openModal = () => useModal().add(new Modal(shallowRef(ModalSyntax), {}, () => {}, true));
-
-const categories = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
-
-const accessibilities: ANode[] = [
- { id: 1, label: 'Visible', parent_id: '' },
- { id: 2, label: 'Draft', parent_id: '' },
- { id: 3, label: 'Archive', parent_id: '' },
-];
-
-const toolbar = [
- {
- name: 'Bold',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>',
- action: 'bold',
- },
- {
- name: 'Italic',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>',
- action: 'italic',
- },
- {
- name: 'Underline',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>',
- action: 'underline',
- },
- {
- name: 'Strike',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"/></svg>',
- action: 'strike',
- },
- {
- name: 'Link',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>',
- action: 'link',
- },
- {
- name: 'Image',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>',
- action: 'image',
- },
- {
- name: 'Code',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>',
- action: 'code',
- },
- {
- name: 'Quote',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>',
- action: 'quote',
- },
- {
- name: 'List',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>',
- action: 'list',
- },
- {
- name: 'Ordered List',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-80v-60h100v-30h-60v-60h60v-30H680v-60h120q17 0 28.5 11.5T840-280v40q0 17-11.5 28.5T800-200q17 0 28.5 11.5T840-160v40q0 17-11.5 28.5T800-80H680Zm0-280v-110q0-17 11.5-28.5T720-510h60v-30H680v-60h120q17 0 28.5 11.5T840-560v70q0 17-11.5 28.5T800-450h-60v30h100v60H680Zm60-280v-180h-60v-60h120v240h-60ZM120-200v-80h480v80H120Zm0-240v-80h480v80H120Zm0-240v-80h480v80H120Z"/></svg>',
- action: 'orderedList',
- },
- {
- name: 'Table',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"/></svg>',
- action: 'gridOrganization',
- },
- {
- name: 'Color',
- icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-518q0 115-70 176.5T640-280h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80Zm0-400Zm-220 40q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120-160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm200 0q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120 160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17ZM480-160q9 0 14.5-5t5.5-13q0-14-15-33t-15-57q0-42 29-67t71-25h70q66 0 113-38.5T800-518q0-121-92.5-201.5T488-800q-136 0-232 93t-96 227q0 133 93.5 226.5T480-160Z"/></svg>`,
- action: 'openColorPicker',
- },
- {
- name: 'Preview',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm280-80q-82 0-146.5-44.5T240-440q29-71 93.5-115.5T480-600q82 0 146.5 44.5T720-440q-29 71-93.5 115.5T480-280Zm0-60q56 0 102-26.5t72-73.5q-26-47-72-73.5T480-540q-56 0-102 26.5T306-440q26 47 72 73.5T480-340Zm0-100Zm0 60q25 0 42.5-17.5T540-440q0-25-17.5-42.5T480-500q-25 0-42.5 17.5T420-440q0 25 17.5 42.5T480-380Z"/></svg>',
- action: 'preview',
- },
- {
- name: 'Save',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>',
- action: 'save',
- },
- {
- name: 'Go to Document',
- icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>`,
- action: 'goto',
- },
-];
-</script>
-<style scoped lang="scss">
-.toolbar {
- display: flex;
- width: 100%;
- padding: 0.15rem;
- border: 1px solid var(--border-color);
- border-radius: 20px;
- color: var(--font-color-dark);
- align-items: center;
- flex-wrap: wrap;
- gap: 0 3px;
- user-select: none;
-}
-
-.btn {
- display: flex;
- margin: 0;
- padding: 4px;
- border-radius: 50%;
- transition: background-color 0.2s;
- align-items: center;
- justify-content: center;
- transform: none;
-
- &:hover {
- background-color: var(--primary-bg);
-
- &:deep(svg) {
- transition: fill 0.2s;
- fill: var(--primary);
- }
- }
-}
-
-.color-picker .btn.color {
- position: relative;
- width: 30px;
- height: 30px;
-}
-
-.color-picker .btn.color .dot {
- position: absolute;
- right: 2px;
- bottom: 2px;
- width: 8px;
- height: 8px;
- border: 1px solid var(--border-color);
- border-radius: 999px;
- background: var(--primary);
-}
-
-.btn:deep(svg) {
- width: 24px;
- height: 24px;
- fill: var(--font-color-dark);
-}
-
-input,
-.select {
- display: inline-block;
- max-width: 350px;
-}
-
-.entry {
- background-color: var(--bg-color);
-}
-
-.help {
- margin-left: auto;
-
- &:hover:deep(svg) {
- fill: var(--font-color-dark);
- }
-}
-</style>
++<<<<<<< HEAD
+<template>
+ <div class="toolbar">
+ <!-- eslint-disable-next-line vue/no-v-html -->
+ <button v-for="item in toolbar" :key="item.name" :title="item.name" class="btn" @click="emitAction(item.action)" v-html="item.icon" />
+ <VoiceRecognition @transcription="handleTranscription" />
+ <div class="color-picker" />
+ <AppSelect v-if="!minimal" v-model="localValue.accessibility" :items="accessibilities" placeholder="Access" size="100px" class="entry" />
+ <AppSelect v-if="!minimal" v-model="localValue.category" :items="categories" placeholder="Select category" size="300px" class="entry" />
+ <AppHint text="Tags has been moved down" />
+ <button class="help" @click="openModal">
+ <Icon name="help" :big="true" fill="var(--font-color-light)" />
+ </button>
+ </div>
+</template>
+
+<script setup lang="ts">
+import type { Document } from '~/stores';
+import ModalSyntax from './ModalSyntax.vue';
+import VoiceRecognition from './VoiceRecognition.vue';
+
+const props = defineProps<{
+ modelValue: Partial<Document>;
+ minimal?: boolean;
+}>();
+
+const emit = defineEmits<{
+ (e: 'update:modelValue', value: Partial<Document>): void;
+ (e: 'execute-action', action: string, payload?: any): void;
+}>();
+
+const localValue = computed({
+ get: () => props.modelValue,
+ set: val => emit('update:modelValue', val),
+});
+
+const emitAction = (action: string) => emit('execute-action', action);
+
+const handleTranscription = (text: string) => {
+ emit('execute-action', 'insertText', text);
+};
+
+const openModal = () => useModal().add(new Modal(shallowRef(ModalSyntax), {}, () => {}, true));
+
+const categories = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
+
+const accessibilities: ANode[] = [
+ { id: 1, label: 'Visible', parent_id: '' },
+ { id: 2, label: 'Draft', parent_id: '' },
+ { id: 3, label: 'Archive', parent_id: '' },
+];
+
+const toolbar = [
+ {
+ name: 'Bold',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>',
+ action: 'bold',
+ },
+ {
+ name: 'Italic',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>',
+ action: 'italic',
+ },
+ {
+ name: 'Underline',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>',
+ action: 'underline',
+ },
+ {
+ name: 'Strike',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"/></svg>',
+ action: 'strike',
+ },
+ {
+ name: 'Link',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>',
+ action: 'link',
+ },
+ {
+ name: 'Image',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>',
+ action: 'image',
+ },
+ {
+ name: 'Code',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>',
+ action: 'code',
+ },
+ {
+ name: 'Quote',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>',
+ action: 'quote',
+ },
+ {
+ name: 'List',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>',
+ action: 'list',
+ },
+ {
+ name: 'Ordered List',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-80v-60h100v-30h-60v-60h60v-30H680v-60h120q17 0 28.5 11.5T840-280v40q0 17-11.5 28.5T800-200q17 0 28.5 11.5T840-160v40q0 17-11.5 28.5T800-80H680Zm0-280v-110q0-17 11.5-28.5T720-510h60v-30H680v-60h120q17 0 28.5 11.5T840-560v70q0 17-11.5 28.5T800-450h-60v30h100v60H680Zm60-280v-180h-60v-60h120v240h-60ZM120-200v-80h480v80H120Zm0-240v-80h480v80H120Zm0-240v-80h480v80H120Z"/></svg>',
+ action: 'orderedList',
+ },
+ {
+ name: 'Grid Organization',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" rx="3" ry="3" fill="none" stroke="currentColor" stroke-width="2"/><g fill="none" stroke="currentColor" stroke-width="2"><line x1="2" y1="8" x2="22" y2="8"/><line x1="2" y1="16" x2="22" y2="16"/><line x1="8" y1="2" x2="8" y2="22"/><line x1="16" y1="2" x2="16" y2="22"/></g></svg>', action: 'gridOrganization',
+ },
+ {
+ name: 'Color',
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-518q0 115-70 176.5T640-280h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80Zm0-400Zm-220 40q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120-160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm200 0q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120 160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17ZM480-160q9 0 14.5-5t5.5-13q0-14-15-33t-15-57q0-42 29-67t71-25h70q66 0 113-38.5T800-518q0-121-92.5-201.5T488-800q-136 0-232 93t-96 227q0 133 93.5 226.5T480-160Z"/></svg>`,
+ action: 'openColorPicker',
+ },
+ {
+ name: 'Preview',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm280-80q-82 0-146.5-44.5T240-440q29-71 93.5-115.5T480-600q82 0 146.5 44.5T720-440q-29 71-93.5 115.5T480-280Zm0-60q56 0 102-26.5t72-73.5q-26-47-72-73.5T480-540q-56 0-102 26.5T306-440q26 47 72 73.5T480-340Zm0-100Zm0 60q25 0 42.5-17.5T540-440q0-25-17.5-42.5T480-500q-25 0-42.5 17.5T420-440q0 25 17.5 42.5T480-380Z"/></svg>',
+ action: 'preview',
+ },
+ {
+ name: 'Save',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>',
+ action: 'save',
+ },
+ {
+ name: 'Go to Document',
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>`,
+ action: 'goto',
+ },
+];
+</script>
+<style scoped lang="scss">
+.toolbar {
+ display: flex;
+ width: 100%;
+ padding: 0.15rem;
+ border: 1px solid var(--border-color);
+ border-radius: 20px;
+ color: var(--font-color-dark);
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 0 3px;
+ user-select: none;
+}
+
+.btn {
+ display: flex;
+ margin: 0;
+ padding: 4px;
+ border-radius: 50%;
+ transition: background-color 0.2s;
+ align-items: center;
+ justify-content: center;
+ transform: none;
+
+ &:hover {
+ background-color: var(--primary-bg);
+
+ &:deep(svg) {
+ transition: fill 0.2s;
+ fill: var(--primary);
+ }
+ }
+}
+
+.color-picker .btn.color {
+ position: relative;
+ width: 30px;
+ height: 30px;
+}
+
+.color-picker .btn.color .dot {
+ position: absolute;
+ right: 2px;
+ bottom: 2px;
+ width: 8px;
+ height: 8px;
+ border: 1px solid var(--border-color);
+ border-radius: 999px;
+ background: var(--primary);
+}
+
+.btn:deep(svg) {
+ width: 24px;
+ height: 24px;
+ fill: var(--font-color-dark);
+}
+
+input,
+.select {
+ display: inline-block;
+ max-width: 350px;
+}
+
+.entry {
+ background-color: var(--bg-color);
+}
+
+.help {
+ margin-left: auto;
+
+ &:hover:deep(svg) {
+ fill: var(--font-color-dark);
+ }
+}
+</style>
++=======
++<template>
++ <div class="toolbar">
++ <!-- eslint-disable-next-line vue/no-v-html -->
++ <button v-for="item in toolbar" :key="item.name" :title="item.name" class="btn" @click="emitAction(item.action)" v-html="item.icon" />
++ <div class="color-picker" />
++ <AppSelect v-if="!minimal" v-model="localValue.accessibility" :items="accessibilities" placeholder="Access" size="100px" class="entry" />
++ <AppSelect v-if="!minimal" v-model="localValue.category" :items="categories" placeholder="Select category" size="300px" class="entry" />
++ <AppHint text="Tags has been moved down" />
++ <button class="help" @click="openModal">
++ <Icon name="help" :big="true" fill="var(--font-color-light)" />
++ </button>
++ </div>
++</template>
++
++<script setup lang="ts">
++import type { Document } from '~/stores';
++import ModalSyntax from './ModalSyntax.vue';
++
++const props = defineProps<{
++ modelValue: Partial<Document>;
++ minimal?: boolean;
++}>();
++
++const emit = defineEmits<{
++ (e: 'update:modelValue', value: Partial<Document>): void;
++ (e: 'execute-action', action: string): void;
++}>();
++
++const localValue = computed({
++ get: () => props.modelValue,
++ set: val => emit('update:modelValue', val),
++});
++
++const emitAction = (action: string) => emit('execute-action', action);
++
++const openModal = () => useModal().add(new Modal(shallowRef(ModalSyntax), {}, () => {}, true));
++
++const categories = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
++
++const accessibilities: ANode[] = [
++ { id: 1, label: 'Visible', parent_id: '' },
++ { id: 2, label: 'Draft', parent_id: '' },
++ { id: 3, label: 'Archive', parent_id: '' },
++];
++
++const toolbar = [
++ {
++ name: 'Bold',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>',
++ action: 'bold',
++ },
++ {
++ name: 'Italic',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>',
++ action: 'italic',
++ },
++ {
++ name: 'Underline',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>',
++ action: 'underline',
++ },
++ {
++ name: 'Strike',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"/></svg>',
++ action: 'strike',
++ },
++ {
++ name: 'Link',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>',
++ action: 'link',
++ },
++ {
++ name: 'Image',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>',
++ action: 'image',
++ },
++ {
++ name: 'Code',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>',
++ action: 'code',
++ },
++ {
++ name: 'Quote',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>',
++ action: 'quote',
++ },
++ {
++ name: 'List',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>',
++ action: 'list',
++ },
++ {
++ name: 'Ordered List',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-80v-60h100v-30h-60v-60h60v-30H680v-60h120q17 0 28.5 11.5T840-280v40q0 17-11.5 28.5T800-200q17 0 28.5 11.5T840-160v40q0 17-11.5 28.5T800-80H680Zm0-280v-110q0-17 11.5-28.5T720-510h60v-30H680v-60h120q17 0 28.5 11.5T840-560v70q0 17-11.5 28.5T800-450h-60v30h100v60H680Zm60-280v-180h-60v-60h120v240h-60ZM120-200v-80h480v80H120Zm0-240v-80h480v80H120Zm0-240v-80h480v80H120Z"/></svg>',
++ action: 'orderedList',
++ },
++ {
++ name: 'Table',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"/></svg>',
++ action: 'gridOrganization',
++ },
++ {
++ name: 'Color',
++ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-518q0 115-70 176.5T640-280h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80Zm0-400Zm-220 40q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120-160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm200 0q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120 160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17ZM480-160q9 0 14.5-5t5.5-13q0-14-15-33t-15-57q0-42 29-67t71-25h70q66 0 113-38.5T800-518q0-121-92.5-201.5T488-800q-136 0-232 93t-96 227q0 133 93.5 226.5T480-160Z"/></svg>`,
++ action: 'openColorPicker',
++ },
++ {
++ name: 'Preview',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm280-80q-82 0-146.5-44.5T240-440q29-71 93.5-115.5T480-600q82 0 146.5 44.5T720-440q-29 71-93.5 115.5T480-280Zm0-60q56 0 102-26.5t72-73.5q-26-47-72-73.5T480-540q-56 0-102 26.5T306-440q26 47 72 73.5T480-340Zm0-100Zm0 60q25 0 42.5-17.5T540-440q0-25-17.5-42.5T480-500q-25 0-42.5 17.5T420-440q0 25 17.5 42.5T480-380Z"/></svg>',
++ action: 'preview',
++ },
++ {
++ name: 'Save',
++ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>',
++ action: 'save',
++ },
++ {
++ name: 'Go to Document',
++ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>`,
++ action: 'goto',
++ },
++];
++</script>
++<style scoped lang="scss">
++.toolbar {
++ display: flex;
++ width: 100%;
++ padding: 0.15rem;
++ border: 1px solid var(--border-color);
++ border-radius: 20px;
++ color: var(--font-color-dark);
++ align-items: center;
++ flex-wrap: wrap;
++ gap: 0 3px;
++ user-select: none;
++}
++
++.btn {
++ display: flex;
++ margin: 0;
++ padding: 4px;
++ border-radius: 50%;
++ transition: background-color 0.2s;
++ align-items: center;
++ justify-content: center;
++ transform: none;
++
++ &:hover {
++ background-color: var(--primary-bg);
++
++ &:deep(svg) {
++ transition: fill 0.2s;
++ fill: var(--primary);
++ }
++ }
++}
++
++.color-picker .btn.color {
++ position: relative;
++ width: 30px;
++ height: 30px;
++}
++
++.color-picker .btn.color .dot {
++ position: absolute;
++ right: 2px;
++ bottom: 2px;
++ width: 8px;
++ height: 8px;
++ border: 1px solid var(--border-color);
++ border-radius: 999px;
++ background: var(--primary);
++}
++
++.btn:deep(svg) {
++ width: 24px;
++ height: 24px;
++ fill: var(--font-color-dark);
++}
++
++input,
++.select {
++ display: inline-block;
++ max-width: 350px;
++}
++
++.entry {
++ background-color: var(--bg-color);
++}
++
++.help {
++ margin-left: auto;
++
++ &:hover:deep(svg) {
++ fill: var(--font-color-dark);
++ }
++}
++</style>
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
diff --cc frontend/app/components/MarkdownSyntax.vue
index debed2d4,41e18f16..62cb9fd3
--- a/frontend/app/components/MarkdownSyntax.vue
+++ b/frontend/app/components/MarkdownSyntax.vue
@@@ -99,67 -99,10 +99,74 @@@ Custom RGB allowed: {color:#2cafcc}(cus
<h2>đŸ”Č Grid Organization</h2>
<p>Use the <strong>Grid Organization</strong> button in the toolbar to create custom layouts:</p>
++<<<<<<< HEAD
+
+ <h3>Quick Presets</h3>
+ <p>Pre-built grid layouts for common use cases:</p>
+
+ <div class="grid-examples">
+ <div class="grid-example">
+ <h4>2x2 Grid</h4>
+ <div class="grid-preview grid-2x2">
+ <div class="grid-cell">Cell 1</div>
+ <div class="grid-cell">Cell 2</div>
+ <div class="grid-cell">Cell 3</div>
+ <div class="grid-cell">Cell 4</div>
+ </div>
+ <p><strong>Perfect for:</strong> Comparing two concepts, pros/cons lists</p>
+ </div>
+
+ <div class="grid-example">
+ <h4>3x2 Grid</h4>
+ <div class="grid-preview grid-3x2">
+ <div class="grid-cell">Cell 1</div>
+ <div class="grid-cell">Cell 2</div>
+ <div class="grid-cell">Cell 3</div>
+ <div class="grid-cell">Cell 4</div>
+ <div class="grid-cell">Cell 5</div>
+ <div class="grid-cell">Cell 6</div>
+ </div>
+ <p><strong>Ideal for:</strong> Feature comparisons, process steps</p>
+ </div>
+
+ <div class="grid-example">
+ <h4>2x3 Grid</h4>
+ <div class="grid-preview grid-2x3">
+ <div class="grid-cell">Cell 1</div>
+ <div class="grid-cell">Cell 2</div>
+ <div class="grid-cell">Cell 3</div>
+ <div class="grid-cell">Cell 4</div>
+ <div class="grid-cell">Cell 5</div>
+ <div class="grid-cell">Cell 6</div>
+ </div>
+ <p><strong>Great for:</strong> Step-by-step processes, timelines</p>
+ </div>
+
+ <div class="grid-example">
+ <h4>3x3 Grid</h4>
+ <div class="grid-preview grid-3x3">
+ <div class="grid-cell">Cell 1</div>
+ <div class="grid-cell">Cell 2</div>
+ <div class="grid-cell">Cell 3</div>
+ <div class="grid-cell">Cell 4</div>
+ <div class="grid-cell">Cell 5</div>
+ <div class="grid-cell">Cell 6</div>
+ <div class="grid-cell">Cell 7</div>
+ <div class="grid-cell">Cell 8</div>
+ <div class="grid-cell">Cell 9</div>
+ </div>
+ <p><strong>Comprehensive:</strong> Information display, data organization</p>
+ </div>
+ </div>
+ <h3>Generated Markdown</h3>
+ <p>Here's what gets inserted when you use the Grid Organization tool:</p>
+
++=======
+
+ <h3>Generated Markdown</h3>
+ <p>Here's what gets inserted when you use the Grid Organization tool:</p>
+
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
<div class="markdown-examples">
<div class="example-section">
<h4>Simple 2x2 Table</h4>
@@@ -183,10 -126,12 +190,19 @@@
</tbody>
</table>
</div>
++<<<<<<< HEAD
+ <pre>| Header 1 | Header 2 |
+|----------|----------|
+| Cell 1 | Cell 2 |
+| Cell 3 | Cell 4 |</pre>
++=======
+ <pre>
+ | Header 1 | Header 2 |
+ |----------|----------|
+ | Cell 1 | Cell 2 |
+ | Cell 3 | Cell 4 |</pre
+ >
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</div>
<div class="example-section">
@@@ -219,11 -164,13 +235,21 @@@
</tbody>
</table>
</div>
++<<<<<<< HEAD
+ <pre>| Product | Price | Rating |
+|---------|--------|--------|
+| Item A | $19.99 | ⭐⭐⭐⭐⭐ |
+| Item B | $29.99 | ⭐⭐⭐⭐ |
+| Item C | $39.99 | ⭐⭐⭐ |</pre>
++=======
+ <pre>
+ | Product | Price | Rating |
+ |---------|--------|--------|
+ | Item A | $19.99 | ⭐⭐⭐⭐⭐ |
+ | Item B | $29.99 | ⭐⭐⭐⭐ |
+ | Item C | $39.99 | ⭐⭐⭐ |</pre
+ >
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
</div>
</div>
@@@ -363,164 -310,6 +389,167 @@@ Snippets help you focus on writing, no
overflow-x: auto;
}
++<<<<<<< HEAD
+/* Grid Organization Examples */
+.grid-examples {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ gap: 2rem;
+ margin: 1.5rem 0;
+}
+
+.grid-example {
+ background: var(--bg-color-secondary);
+ border: 1px solid var(--border-color);
+ border-radius: 12px;
+ padding: 1.5rem;
+ text-align: center;
+}
+
+.grid-example h4 {
+ margin: 0 0 1rem 0;
+ color: var(--primary);
+ font-size: 1.1rem;
+ font-weight: 600;
+}
+
+.grid-preview {
+ display: grid;
+ gap: 4px;
+ margin: 1rem 0;
+ justify-content: center;
+}
+
+.grid-2x2 {
+ grid-template-columns: repeat(2, 60px);
+ grid-template-rows: repeat(2, 40px);
+}
+
+.grid-3x2 {
+ grid-template-columns: repeat(3, 50px);
+ grid-template-rows: repeat(2, 40px);
+}
+
+.grid-2x3 {
+ grid-template-columns: repeat(2, 60px);
+ grid-template-rows: repeat(3, 35px);
+}
+
+.grid-3x3 {
+ grid-template-columns: repeat(3, 50px);
+ grid-template-rows: repeat(3, 35px);
+}
+
+.grid-cell {
+ background: var(--primary);
+ color: white;
+ border-radius: 6px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 0.8rem;
+ font-weight: 500;
+ text-align: center;
+ padding: 4px;
+ transition: all 0.3s ease;
+}
+
+.grid-cell:hover {
+ transform: scale(1.05);
+ box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
+}
+
+/* Custom Grid Layouts */
+.custom-grid-examples {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 2rem;
+ margin: 1.5rem 0;
+}
+
+.custom-grid-example {
+ background: var(--bg-color-secondary);
+ border: 1px solid var(--border-color);
+ border-radius: 12px;
+ padding: 1.5rem;
+}
+
+.custom-grid-example h4 {
+ margin: 0 0 1rem 0;
+ color: var(--primary);
+ font-size: 1.1rem;
+ font-weight: 600;
+}
+
+.custom-grid-preview {
+ display: grid;
+ gap: 4px;
+ margin: 1rem 0;
+}
+
+.header-content {
+ grid-template-columns: 2fr 1fr;
+ grid-template-rows: auto 1fr;
+}
+
+.header-content .header-cell {
+ grid-column: 1 / -1;
+ background: var(--blue);
+ height: 50px;
+}
+
+.header-content .content-cell {
+ background: var(--green);
+ height: 80px;
+}
+
+.header-content .sidebar-cell {
+ background: var(--purple);
+ height: 80px;
+}
+
+.feature-compare {
+ grid-template-columns: 1fr 1fr 1fr;
+ grid-template-rows: auto auto auto;
+}
+
+.feature-compare .feature-header {
+ grid-column: 1 / -1;
+ background: var(--primary);
+ height: 40px;
+}
+
+.feature-compare .plan-a {
+ background: var(--blue);
+ height: 35px;
+}
+
+.feature-compare .plan-b {
+ background: var(--green);
+ height: 35px;
+}
+
+.feature-compare .feature-1,
+.feature-compare .feature-2 {
+ background: var(--grey);
+ height: 35px;
+}
+
+.feature-compare .plan-a-yes,
+.feature-compare .plan-b-yes {
+ background: var(--green);
+ height: 35px;
+ font-size: 1.2rem;
+}
+
+.feature-compare .plan-a-no {
+ background: var(--red);
+ height: 35px;
+ font-size: 1.2rem;
+}
+
++=======
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
/* Markdown Examples */
.markdown-examples {
display: grid;
@@@ -576,24 -365,13 +605,34 @@@
/* Responsive adjustments */
@media (max-width: 768px) {
++<<<<<<< HEAD
+ .grid-examples,
+ .custom-grid-examples,
++=======
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
.markdown-examples {
grid-template-columns: 1fr;
gap: 1.5rem;
}
++<<<<<<< HEAD
+
+ .grid-example,
+ .custom-grid-example,
+ .example-section {
+ padding: 1rem;
+ }
+
+ .grid-2x2,
+ .grid-3x2,
+ .grid-2x3,
+ .grid-3x3 {
+ transform: scale(0.9);
+ }
++=======
+
+ .example-section {
+ padding: 1rem;
+ }
++>>>>>>> 4cf5f349be0800eddc51160dc064c70cd715fbe4
}
</style>