fix: close Coloris picker on iframe clicks and improve editor styling
Add click handler on iframe to close Coloris color picker when user clicks in the preview area. Also improve editor panel spacing and styling consistency. Coloris Close Fix: - Import Coloris in App.vue - Add click listener on iframe document to call Coloris.close() - Fixes issue where Coloris remained open when clicking in preview iframe (clicks in iframes don't bubble to parent document) Editor Styling Improvements: - Increase EditorPanel width from 30rem to 35rem for better readability - Add CSS variable --space-xs (0.5rem) for consistent spacing - Improve form field spacing with gaps and better padding - Add row-gap to margins subsection - Fix input-with-color width and button height (1.1rem) - Add gap to unit-toggle buttons - Better visual hierarchy with margins on h2 and h3 CSS Changes: - _forms.scss: Consistent spacing, better input padding, gap utilities - _variables.scss: Add --space-xs variable - Compiled CSS updated with new styles 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6a01909b38
commit
3bd6c7ca19
8 changed files with 91 additions and 21 deletions
|
|
@ -63,7 +63,7 @@ provide('activeTab', activeTab);
|
|||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 30rem;
|
||||
width: 35rem;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
|
|
@ -392,16 +392,23 @@ const updatePageFooters = () => {
|
|||
currentCss = currentCss.replace(/@page:right\s*\{[^}]*\}/g, '');
|
||||
|
||||
// Remove old @page @bottom-center rule if exists
|
||||
currentCss = currentCss.replace(/@page\s*\{[^}]*@bottom-center[^}]*\}/g, (match) => {
|
||||
return match.replace(/@bottom-center\s*\{[^}]*\}/g, '');
|
||||
});
|
||||
currentCss = currentCss.replace(
|
||||
/@page\s*\{[^}]*@bottom-center[^}]*\}/g,
|
||||
(match) => {
|
||||
return match.replace(/@bottom-center\s*\{[^}]*\}/g, '');
|
||||
}
|
||||
);
|
||||
|
||||
// Remove string-set rule if running title is disabled
|
||||
if (!runningTitle.value) {
|
||||
currentCss = currentCss.replace(/\.chapter\s*>\s*h2\s*\{[^}]*string-set:[^}]*\}\s*/g, '');
|
||||
currentCss = currentCss.replace(
|
||||
/\.chapter\s*>\s*h2\s*\{[^}]*string-set:[^}]*\}\s*/g,
|
||||
''
|
||||
);
|
||||
} else if (!currentCss.includes('string-set: title')) {
|
||||
// Add the string-set rule for h2 titles if running title is enabled
|
||||
const stringSetRule = '\n.chapter > h2 {\n string-set: title content(text);\n}\n';
|
||||
const stringSetRule =
|
||||
'\n.chapter > h2 {\n string-set: title content(text);\n}\n';
|
||||
currentCss += stringSetRule;
|
||||
}
|
||||
|
||||
|
|
@ -416,7 +423,8 @@ const updatePageFooters = () => {
|
|||
|
||||
if (pageNumbers.value && runningTitle.value) {
|
||||
// Page number on the left, title right next to it
|
||||
leftBottomLeft = ' @bottom-left {\n content: counter(page) " " string(title);\n }\n';
|
||||
leftBottomLeft =
|
||||
' @bottom-left {\n content: counter(page) " " string(title);\n }\n';
|
||||
} else if (pageNumbers.value) {
|
||||
leftBottomLeft = ' @bottom-left {\n content: counter(page);\n }\n';
|
||||
} else if (runningTitle.value) {
|
||||
|
|
@ -432,11 +440,14 @@ const updatePageFooters = () => {
|
|||
|
||||
if (pageNumbers.value && runningTitle.value) {
|
||||
// Title on the left of page number
|
||||
rightBottomRight = ' @bottom-right {\n content: string(title) " " counter(page);\n }\n';
|
||||
rightBottomRight =
|
||||
' @bottom-right {\n content: string(title) " " counter(page);\n }\n';
|
||||
} else if (pageNumbers.value) {
|
||||
rightBottomRight = ' @bottom-right {\n content: counter(page);\n }\n';
|
||||
rightBottomRight =
|
||||
' @bottom-right {\n content: counter(page);\n }\n';
|
||||
} else if (runningTitle.value) {
|
||||
rightBottomRight = ' @bottom-right {\n content: string(title);\n }\n';
|
||||
rightBottomRight =
|
||||
' @bottom-right {\n content: string(title);\n }\n';
|
||||
}
|
||||
|
||||
if (rightBottomRight) {
|
||||
|
|
@ -498,8 +509,12 @@ const syncFromStore = () => {
|
|||
}
|
||||
|
||||
// Check for page numbers and running title in @page:left and @page:right
|
||||
const leftPageMatch = stylesheetStore.content.match(/@page:left\s*\{[^}]*\}/);
|
||||
const rightPageMatch = stylesheetStore.content.match(/@page:right\s*\{[^}]*\}/);
|
||||
const leftPageMatch = stylesheetStore.content.match(
|
||||
/@page:left\s*\{[^}]*\}/
|
||||
);
|
||||
const rightPageMatch = stylesheetStore.content.match(
|
||||
/@page:right\s*\{[^}]*\}/
|
||||
);
|
||||
|
||||
// Check if page numbers exist (counter(page) in either left or right)
|
||||
const hasPageNumbers =
|
||||
|
|
@ -537,7 +552,11 @@ const updateColorisButton = () => {
|
|||
|
||||
// Watch for when the user returns to the "document" tab
|
||||
watch(activeTab, (newTab, oldTab) => {
|
||||
if (newTab === 'document' && oldTab !== 'document' && background.value.value) {
|
||||
if (
|
||||
newTab === 'document' &&
|
||||
oldTab !== 'document' &&
|
||||
background.value.value
|
||||
) {
|
||||
// Small delay to ensure DOM is ready
|
||||
setTimeout(updateColorisButton, 100);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue