Skip to content

Commit 21b5d60

Browse files
committed
improve styles encapsulation
1 parent ca47381 commit 21b5d60

28 files changed

Lines changed: 63 additions & 102 deletions

File tree

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

Lines changed: 4 additions & 4 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;
@@ -323,4 +323,4 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
323323
}
324324
.ProseMirror-active-search-match {
325325
background-color: #ff6a0054;
326-
}
326+
}

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"
@@ -121,7 +121,7 @@ const handleClickOutside = (e) => {
121121
</n-tooltip>
122122
</n-dropdown>
123123

124-
<n-tooltip trigger="hover" v-else-if="isButton(item)">
124+
<n-tooltip trigger="hover" v-else-if="isButton(item)" class="sd-editor-toolbar-tooltip">
125125
<template #trigger>
126126
<ToolbarButton
127127
:toolbar-item="item"
@@ -146,26 +146,26 @@ const handleClickOutside = (e) => {
146146
</template>
147147

148148
<style lang="postcss">
149-
.n-dropdown {
149+
.sd-editor-toolbar-dropdown {
150150
border-radius: 8px;
151151
min-width: 80px;
152+
cursor: pointer;
152153
}
153-
.n-tooltip,
154-
.n-popover {
155-
background-color: #333333 !important;
156-
font-size: 14px;
157-
border-radius: 8px !important;
158-
}
159-
.n-dropdown-option-body {
154+
155+
.sd-editor-toolbar-dropdown .n-dropdown-option-body {
160156
&:hover {
161157
&::before,
162158
&::after {
163159
background-color: #d8dee5 !important;
164160
}
165161
}
166162
}
167-
.toolbar-dropdown {
168-
cursor: pointer;
163+
164+
.sd-editor-toolbar-tooltip,
165+
.sd-editor-toolbar-tooltip.n-popover {
166+
background-color: #333333 !important;
167+
font-size: 14px;
168+
border-radius: 8px !important;
169169
}
170170
</style>
171171

0 commit comments

Comments
 (0)