Skip to content

Commit

Permalink
Improve handling of unformatted text (#197)
Browse files Browse the repository at this point in the history
- do not assume any pasted text that includes a span is unformatted (nowiki)
- visually highlight unformatted text in editor
- disable adding format marks (like bold) inside unformatted text
- add 'unformatted' to text style dropdown

Fixes #190

Addresses but does not yet resolve #101
  • Loading branch information
annda committed Dec 13, 2023
1 parent bd009bf commit 4b4f793
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions lang/de/lang.php
Expand Up @@ -92,6 +92,7 @@
$lang['js']['label:subscript'] = 'tief stellen';
$lang['js']['label:deleted'] = 'durchstreichen';
$lang['js']['label:monospaced'] = 'feste Zeichenbreite';
$lang['js']['label:unformatted'] = 'Wiki-Formatierung ignorieren';
$lang['js']['label:undo'] = 'rückgängig machen';
$lang['js']['label:redo'] = 'wiederherstellen';

Expand Down
1 change: 1 addition & 0 deletions lang/en/lang.php
Expand Up @@ -92,6 +92,7 @@
$lang['js']['label:subscript'] = 'subscript';
$lang['js']['label:deleted'] = 'strike through';
$lang['js']['label:monospaced'] = 'monospaced';
$lang['js']['label:unformatted'] = 'ignore wiki formatting';
$lang['js']['label:undo'] = 'undo';
$lang['js']['label:redo'] = 'redo';

Expand Down
1 change: 1 addition & 0 deletions script/plugins/Menu/MDI.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions script/plugins/Menu/MenuInitializer.js
Expand Up @@ -65,6 +65,7 @@ class MenuInitializer {
new MarkMenuItemDispatcher('subscript', 'format-subscript', lang['label:subscript']),
new MarkMenuItemDispatcher('deleted', 'format-strikethrough', lang['label:deleted']),
new MarkMenuItemDispatcher('code', 'console-line', lang['label:monospaced']),
new MarkMenuItemDispatcher('unformatted', 'translate-off', lang['label:unformatted']),
]),
LinkMenuItemDispatcher,
ImageMenuItemDispatcher,
Expand Down
4 changes: 1 addition & 3 deletions script/schema.js
Expand Up @@ -326,9 +326,7 @@ export default function getSpec() {
});

marks = marks.addToEnd('unformatted', {
parseDOM: [
{ tag: 'span', class: 'unformatted' },
],
excludes: '_',
toDOM() {
return ['span', { class: 'unformatted' }];
},
Expand Down
7 changes: 6 additions & 1 deletion style.less
Expand Up @@ -61,6 +61,11 @@
}
}

span.unformatted {
padding: 0.2rem;
border: 1px dotted @ini_border;
}

.footnote {
&::after {
content: counter(prosemirror-footnote) ')';
Expand Down Expand Up @@ -97,7 +102,7 @@
}

div.dropdown_content {
width: 10rem;
min-width: 12rem;

img {
max-width: 1.5rem;
Expand Down

0 comments on commit 4b4f793

Please sign in to comment.