Skip to content

Commit

Permalink
Improve handling of unformatted text
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 12, 2023
1 parent bd009bf commit 6fef7e1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions lang/de/lang.php
Original file line number Diff line number Diff line change
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 (nowiki)';
$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
Original file line number Diff line number Diff line change
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'] = 'unformatted (nowiki)';
$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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
5 changes: 5 additions & 0 deletions style.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
}
}

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

.footnote {
&::after {
content: counter(prosemirror-footnote) ')';
Expand Down

0 comments on commit 6fef7e1

Please sign in to comment.