Skip to content

Commit

Permalink
Merge pull request #967 from nextcloud/fix/text_editor_max_width
Browse files Browse the repository at this point in the history
fix(editor): Set CSS variable `--text-editor-max-width` per default
  • Loading branch information
mejo- authored Oct 30, 2023
2 parents 35cd1a7 + 1fb0d05 commit ce6bf90
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/Page.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<h1 id="titleform" class="page-title" :class="{'sheet-view': !isFullWidthView}">
<h1 id="titleform" class="page-title" :class="[isFullWidthView ? 'full-width-view' : 'sheet-view']">
<!-- Page emoji or icon -->
<div class="page-title-icon"
:class="{ 'mobile': isMobile }">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:show-outline-outside="showOutline"
mime="text/markdown"
class="file-view active"
:class="{'sheet-view': !isFullWidthView}"
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']"
@ready="ready"
@outline-toggled="toggleOutlineFromText"
@add-image-node="onAddImageNode"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/LandingPageWidgets.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="landing-page-widgets"
:class="{'sheet-view': !isFullWidthView}">
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']">
<MembersWidget v-if="!isPublic" />
<RecentPagesWidget />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/PageInfoBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="text-menubar"
:class="{'sheet-view': !isFullWidthView}">
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']">
<div v-if="currentPage.lastUserId" class="infobar-item infobar-lastupdate">
<div class="item-text">
<LastUserBubble :last-user-id="currentPage.lastUserId"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Page/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<WidgetHeading v-if="isLandingPage"
:title="t('collectives', 'Landing page')"
class="text-container-heading"
:class="{'sheet-view': !isFullWidthView}" />
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']" />
<div v-show="showRichText"
id="text-container"
:key="'text-' + currentPage.id"
:class="{'sheet-view': !isFullWidthView}"
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']"
:aria-label="t('collectives', 'Page content')">
<RichText :key="`reader-${currentPage.id}`"
:current-page="currentPage"
Expand Down
5 changes: 3 additions & 2 deletions src/components/Page/Version.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<h1 id="titleform" class="page-title" :class="{'sheet-view': !isFullWidthView}">
<h1 id="titleform" class="page-title" :class="[isFullWidthView ? 'full-width-view' : 'sheet-view']">
<input class="title"
:class="{ 'mobile': isMobile }"
type="text"
Expand All @@ -19,7 +19,8 @@
<NcActionButton icon="icon-menu-sidebar" :close-after-click="true" @click="closeVersions" />
</NcActions>
</h1>
<div id="text-container">
<div id="text-container"
:class="[isFullWidthView ? 'full-width-view' : 'sheet-view']">
<RichText :key="`show-${currentPage.id}-${version.timestamp}`"
:current-page="currentPage"
:page-content="pageVersionContent" />
Expand Down
10 changes: 1 addition & 9 deletions src/components/SkeletonLoading.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="placeholder-main"
:class="placeholderClasses">
:class="[`placeholder-main-${type}`, isFullWidthView ? 'full-width-view' : 'sheet-view']">
<!-- Placeholder animation -->
<template v-for="(suffix, gradientIndex) in ['-regular', '-reverse']">
<svg :key="'gradient' + suffix" :class="'placeholder-gradient placeholder-gradient' + suffix">
Expand Down Expand Up @@ -83,14 +83,6 @@ export default {
'isFullWidthView',
]),
placeholderClasses() {
const classes = [`placeholder-main-${this.type}`]
if (!this.isFullWidthView) {
classes.push('sheet-view')
}
return classes
},
placeholderData() {
const data = []
for (let i = 0; i < this.count; i++) {
Expand Down
5 changes: 5 additions & 0 deletions src/css/editor.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
:root {
--text-editor-max-width: 670px !important;
}

.full-width-view {
--text-editor-max-width: false !important;
max-width: unset;
}

.sheet-view {
Expand Down

0 comments on commit ce6bf90

Please sign in to comment.