mirror of
https://github.com/outline/outline.git
synced 2026-11-29 16:40:27 +03:00
fix: Inline code marks longer than the width of editor escape (#12735)
This commit is contained in:
1 parent
a19ae23a6b
commit
25da5596a9
2 files changed
+11
-2
No files matched your search
@@ -1752,11 +1752,14 @@ code {
|
||||
font-family: ${props.theme.fontFamilyMono};
|
||||
font-size: 90%;
|
||||
|
||||
&.inline {
|
||||
color: ${props.theme.codeKeyword};
|
||||
}
|
||||
|
||||
.${EditorStyleHelper.codeWord} {
|
||||
@media (min-width: ${breakpoints.tablet}px) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
color: ${props.theme.codeKeyword};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,15 @@ import { EditorStyleHelper } from "../styles/EditorStyleHelper";
|
||||
interface CodeWordDecorationsConfig {
|
||||
/** CSS class to apply to word decorations */
|
||||
className?: string;
|
||||
/** Tokens longer than this many characters are left unwrapped so they break */
|
||||
maxWordLength?: number;
|
||||
}
|
||||
|
||||
class CodeWordDecorationsPlugin extends Plugin {
|
||||
constructor(config: CodeWordDecorationsConfig = {}) {
|
||||
const defaultConfig: Required<CodeWordDecorationsConfig> = {
|
||||
className: EditorStyleHelper.codeWord,
|
||||
maxWordLength: 40,
|
||||
};
|
||||
|
||||
const finalConfig = { ...defaultConfig, ...config };
|
||||
@@ -102,7 +105,10 @@ class CodeWordDecorationsPlugin extends Plugin {
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
const word = words[i];
|
||||
|
||||
if (word.length > 0) {
|
||||
// Tokens longer than a line cannot move to the next line as a unit,
|
||||
// so leave them unwrapped to inherit the editor's default breaking
|
||||
// rather than overflow.
|
||||
if (word.length > 0 && word.length <= config.maxWordLength) {
|
||||
const wordStart = currentPos;
|
||||
const wordEnd = wordStart + word.length;
|
||||
|
||||
|
||||
Reference in new issue
Block a user