Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(EditorView): changed default selection styles #520

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions demo/stories/css-variables/CSSVariables.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ export const Story: StoryObj<typeof component> = {
control: {type: 'text'},
description: 'Editor contents padding',
},
'--g-md-wysiwyg-selection-border': {
control: {type: 'text'},
description: 'Editor selection border',
},
'--g-md-wysiwyg-selection-border-radius': {
control: {type: 'text'},
description: 'Editor selection border radius',
},
'--g-md-wysiwyg-selection-outline': {
control: {type: 'text'},
description: 'Editor selection outline',
},
'--g-md-wysiwyg-selection-background': {
control: {type: 'text'},
description: 'Editor selection background',
},
'--g-md-wysiwyg-selection-box-shadow': {
control: {type: 'text'},
description: 'Editor selection box-shadow',
},
},
};
Story.storyName = 'Custom CSS Variables';
Expand Down
10 changes: 10 additions & 0 deletions docs/how-to-customize-the-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## How to customize the editor
You can use CSS variables to make editor contents fit your own needs

### Elements styles
| **Variable** | **Description** | **CSS Property Type** | **Default** |
| :---: | :---: | :---: | :---: |
| `--g-md-toolbar-padding` | Toolbar padding | padding | 0px |
Expand All @@ -11,3 +12,12 @@ You can use CSS variables to make editor contents fit your own needs
| `--g-md-toolbar-sticky-offset` | Toolbar offset in sticky mode | top | 0px |
| `--g-md-toolbar-sticky-border` | Toolbar border in sticky mode | border | 1px solid var(--g-color-line-generic-solid) |
| `--g-md-editor-padding` | Editor contents padding | padding | 0px |

### Selection styles
| **Variable** | **Description** | **CSS Property Type** | **Default** |
| :---: | :---: | :---: | :---: |
| `--g-md-wysiwyg-selection-border` | Editor selection border | border | none |
| `--g-md-wysiwyg-selection-border-radius` | Editor selection border radius | border-radius | 6px |
| `--g-md-wysiwyg-selection-outline` | Editor selection outline | outline | none |
| `--g-md-wysiwyg-selection-background` | Editor selection background | background | #e6e6e6 |
| `--g-md-wysiwyg-selection-box-shadow` | Editor selection box shadow | box-shadow | none |
1 change: 1 addition & 0 deletions src/extensions/additional/Math/MathSpecs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const MathSpecs: ExtensionAuto = (builder) => {
code: true,
toDOM: () => ['div', {class: 'math-block'}, 0],
parseDOM: [{tag: 'div.math-block', priority: 200}],
selectable: true,
},
fromMd: {
tokenName: 'math_block',
Expand Down
1 change: 1 addition & 0 deletions src/extensions/base/BaseSchema/BaseSchemaSpecs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const BaseSchemaSpecs: ExtensionAuto<BaseSchemaSpecsOptions> = (builder,
0,
];
},
selectable: true,
placeholder: opts.paragraphPlaceholder
? {
content: opts.paragraphPlaceholder,
Expand Down
28 changes: 0 additions & 28 deletions src/extensions/base/BaseStyles/index.scss

This file was deleted.

2 changes: 0 additions & 2 deletions src/extensions/base/BaseStyles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {Plugin} from 'prosemirror-state';

import type {ExtensionAuto} from '../../../core';

import './index.scss';

export const BaseStyles: ExtensionAuto = (builder) => {
builder.addPlugin(
() =>
Expand Down
Loading
Loading