Skip to content

Commit 4b4f793

Browse files
authored
Improve handling of unformatted text (#197)
- 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
1 parent bd009bf commit 4b4f793

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

lang/de/lang.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
$lang['js']['label:subscript'] = 'tief stellen';
9393
$lang['js']['label:deleted'] = 'durchstreichen';
9494
$lang['js']['label:monospaced'] = 'feste Zeichenbreite';
95+
$lang['js']['label:unformatted'] = 'Wiki-Formatierung ignorieren';
9596
$lang['js']['label:undo'] = 'rückgängig machen';
9697
$lang['js']['label:redo'] = 'wiederherstellen';
9798

lang/en/lang.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
$lang['js']['label:subscript'] = 'subscript';
9393
$lang['js']['label:deleted'] = 'strike through';
9494
$lang['js']['label:monospaced'] = 'monospaced';
95+
$lang['js']['label:unformatted'] = 'ignore wiki formatting';
9596
$lang['js']['label:undo'] = 'undo';
9697
$lang['js']['label:redo'] = 'redo';
9798

script/plugins/Menu/MDI.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/plugins/Menu/MenuInitializer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class MenuInitializer {
6565
new MarkMenuItemDispatcher('subscript', 'format-subscript', lang['label:subscript']),
6666
new MarkMenuItemDispatcher('deleted', 'format-strikethrough', lang['label:deleted']),
6767
new MarkMenuItemDispatcher('code', 'console-line', lang['label:monospaced']),
68+
new MarkMenuItemDispatcher('unformatted', 'translate-off', lang['label:unformatted']),
6869
]),
6970
LinkMenuItemDispatcher,
7071
ImageMenuItemDispatcher,

script/schema.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ export default function getSpec() {
326326
});
327327

328328
marks = marks.addToEnd('unformatted', {
329-
parseDOM: [
330-
{ tag: 'span', class: 'unformatted' },
331-
],
329+
excludes: '_',
332330
toDOM() {
333331
return ['span', { class: 'unformatted' }];
334332
},

style.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
}
6262
}
6363

64+
span.unformatted {
65+
padding: 0.2rem;
66+
border: 1px dotted @ini_border;
67+
}
68+
6469
.footnote {
6570
&::after {
6671
content: counter(prosemirror-footnote) ')';
@@ -97,7 +102,7 @@
97102
}
98103

99104
div.dropdown_content {
100-
width: 10rem;
105+
min-width: 12rem;
101106

102107
img {
103108
max-width: 1.5rem;

0 commit comments

Comments
 (0)