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

Break links on long lines #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion examples/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ declare global {
}
}

const url = new URL(window.location.href)
const doc = url.searchParams.get('doc') ?? example

window.ink = ink(document.getElementById('app')!, {
doc: example,
doc,
files: {
clipboard: true,
dragAndDrop: true,
Expand All @@ -29,6 +32,13 @@ window.ink = ink(document.getElementById('app')!, {
},
injectMarkup: true,
},
hooks: {
afterUpdate: (text) => {
url.searchParams.set('doc', text)

window.history.replaceState(null, '', url)
},
},
interface: {
images: true,
lists: true,
Expand All @@ -55,3 +65,5 @@ const toggleTheme = (theme: Values.Appearance) => {
window.auto = toggleTheme.bind(undefined, 'auto')
window.dark = toggleTheme.bind(undefined, 'dark')
window.light = toggleTheme.bind(undefined, 'light')

toggleTheme('light')
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@

margin: 0;
}

@media (prefers-color-scheme: dark) {
.auto {
background-color: #222;
color: white;
}
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/examples/web-component.ts"></script>
<script type="module" src="/examples/demo.ts"></script>
<!-- <script type="module" src="/examples/web-component.ts"></script> -->
</body>
</html>
2 changes: 2 additions & 0 deletions src/editor/extensions/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ export const theme = (): Extension => {
{
tag: tags.link,
color: 'var(--ink-internal-syntax-link-color)',
wordBreak: 'break-all',
},
{
tag: tags.url,
color: 'var(--ink-internal-syntax-url-color)',
wordBreak: 'break-all',
},
// string group
{
Expand Down
Loading