Skip to content

Commit 30377df

Browse files
committed
improve styles encapsulation
1 parent 34ea284 commit 30377df

28 files changed

Lines changed: 62 additions & 101 deletions

File tree

packages/super-editor/src/assets/styles/elements/prosemirror.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ img.ProseMirror-separator {
108108
margin: 0 !important;
109109
}
110110

111-
.ProseMirror .super-doc-tab {
111+
.ProseMirror .sd-editor-tab {
112112
display: inline-block;
113113
vertical-align: text-bottom;
114114
}
115115

116-
.ProseMirror u .super-doc-tab:not(.pagination-inner .super-doc-tab) {
116+
.ProseMirror u .sd-editor-tab:not(.pagination-inner .sd-editor-tab) {
117117
white-space: pre;
118118
border-bottom: 1px solid #000;
119119
margin-bottom: 1.5px;
@@ -311,7 +311,7 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
311311
z-index: -1;
312312
}
313313

314-
.super-doc-dropcap {
314+
.sd-editor-dropcap {
315315
float: left;
316316
display: flex;
317317
align-items: baseline;

packages/super-editor/src/assets/styles/elements/toolbar-custom.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
filter: brightness(1.3);
3636
}
3737

38-
39-
4038
@keyframes aiTextAppear {
4139
from {
4240
opacity: 0;

packages/super-editor/src/assets/styles/elements/toolbar.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
}
1010

11-
.n-dropdown-option .dropdown-select-icon {
11+
.sd-editor-toolbar-dropdown .n-dropdown-option .dropdown-select-icon {
1212
display: flex;
1313
width: 12px;
1414
height: 12px;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.comment-highlight {
1+
.sd-editor-comment-highlight {
22
transition: background-color 250ms ease;
33
}
44

5-
.comment-highlight:hover {
5+
.sd-editor-comment-highlight:hover {
66
background-color: #1354FF55;
77
}

packages/super-editor/src/assets/styles/extensions/mention.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.super-editor-mention {
1+
.sd-editor-mention {
22
background-color: #1355ff15;
33
color: #222;
44
font-weight: 400;

packages/super-editor/src/assets/styles/extensions/pagination.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Workaround to display pagination in footer
4646
on the right if it is inside shape textbox.
4747
*/
48-
.pagination-section-footer .pm-shape-container:has(
48+
.pagination-section-footer .sd-editor-shape-container:has(
4949
[data-id="auto-page-number"],
5050
[data-id="auto-total-pages"]
5151
) {

packages/super-editor/src/assets/styles/extensions/placeholder.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.super-editor-placeholder::before {
1+
.sd-editor-placeholder::before {
22
content: attr(data-placeholder);
33
color: #aaa;
44
pointer-events: none;
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.popover {
1+
.sd-editor-popover {
22
background-color: #fff;
33
border-radius: 8px;
44
-webkit-box-shadow: 0px 4px 12px 0px rgba(50, 50, 50, 0.15);
@@ -12,28 +12,24 @@
1212
z-index: 1000;
1313
}
1414

15-
.popover-header {
15+
.sd-editor-popover .popover-header {
1616
font-weight: bold;
1717
margin-bottom: 8px;
1818
}
1919

20-
.tippy-content {
21-
padding: 0;
22-
}
23-
24-
.tippy-box[data-theme~='popover'] {
20+
.tippy-box[data-theme~='sd-editor-popover'] {
2521
background-color: #fff;
2622
border-radius: 8px;
2723
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
28-
border: none;
24+
border: none !important;
25+
padding: 0 !important;
2926
}
3027

31-
.tippy-box[data-theme~='popover'] .tippy-arrow {
28+
.tippy-box[data-theme~='sd-editor-popover'] .tippy-arrow {
3229
color: #fff;
3330
border: 1px solid #dbdbdb;
3431
}
3532

36-
.tippy-box[data-theme~='popover'] {
37-
border: none !important;
38-
padding: none !important;
33+
.tippy-box[data-theme~='sd-editor-popover'] .tippy-content {
34+
padding: 0;
3935
}
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
.disabled {
2-
opacity: 0.5;
3-
cursor: not-allowed;
4-
pointer-events: none;
5-
}
6-
7-
.input-active {
1+
.sd-input-active {
82
border: 1px solid #1355ff !important;
93
}
104

@@ -15,4 +9,4 @@
159
height: 100%;
1610
width: 100%;
1711
outline: none;
18-
}
12+
}

packages/super-editor/src/components/toolbar/ButtonGroup.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const handleClickOutside = (e) => {
101101
:show="item.expand.value"
102102
size="medium"
103103
placement="bottom-start"
104-
class="toolbar-button toolbar-dropdown"
104+
class="toolbar-button toolbar-dropdown sd-editor-toolbar-dropdown"
105105
@select="(key, option) => handleSelect(item, option)"
106106
@clickoutside="handleClickOutside"
107107
:style="item.dropdownStyles.value"
@@ -113,7 +113,7 @@ const handleClickOutside = (e) => {
113113
/>
114114
</n-dropdown>
115115

116-
<n-tooltip trigger="hover" v-else-if="isButton(item)">
116+
<n-tooltip trigger="hover" v-else-if="isButton(item)" class="sd-editor-toolbar-tooltip">
117117
<template #trigger>
118118
<ToolbarButton
119119
:toolbar-item="item"
@@ -138,26 +138,26 @@ const handleClickOutside = (e) => {
138138
</template>
139139

140140
<style lang="postcss">
141-
.n-dropdown {
141+
.sd-editor-toolbar-dropdown {
142142
border-radius: 8px;
143143
min-width: 80px;
144+
cursor: pointer;
144145
}
145-
.n-tooltip,
146-
.n-popover {
147-
background-color: #333333 !important;
148-
font-size: 14px;
149-
border-radius: 8px !important;
150-
}
151-
.n-dropdown-option-body {
146+
147+
.sd-editor-toolbar-dropdown .n-dropdown-option-body {
152148
&:hover {
153149
&::before,
154150
&::after {
155151
background-color: #d8dee5 !important;
156152
}
157153
}
158154
}
159-
.toolbar-dropdown {
160-
cursor: pointer;
155+
156+
.sd-editor-toolbar-tooltip,
157+
.sd-editor-toolbar-tooltip.n-popover {
158+
background-color: #333333 !important;
159+
font-size: 14px;
160+
border-radius: 8px !important;
161161
}
162162
</style>
163163

0 commit comments

Comments
 (0)