Skip to content

Commit

Permalink
check the onclick listener instead, since the pencil class may have e…
Browse files Browse the repository at this point in the history
…xisted (e.g. on the index page of a book preview)
  • Loading branch information
yihui committed Feb 13, 2025
1 parent 43eff44 commit e1da240
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inst/resources/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pre, img { max-width: 100%; }
pre { white-space: pre-wrap; word-break: break-word; }
pre code { display: block; padding: 1em; overflow-x: auto; }
code { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }
:not(pre) > code, code[class], div > .caption { background: #f8f8f8; }
:not(pre, th) > code, code[class], div > .caption { background: #f8f8f8; }
pre > code:is(:not([class]), .language-plain, .language-none, .plain), .box, .figure, .table { background: inherit; border: 1px solid #eee; }
pre > code {
&.message { border-color: #9eeaf9; }
Expand Down
2 changes: 1 addition & 1 deletion inst/resources/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
}
// add classes and events to edit buttons
d.querySelectorAll('a[href]').forEach(a => {
if (a.innerText !== '✎' || a.classList.contains('pencil')) return;
if (a.innerText !== '✎' || a.onclick) return;
a.classList.add('pencil'); if (!a.title) a.title = 'Open';
a.onclick = e => {
e.preventDefault();
Expand Down

0 comments on commit e1da240

Please sign in to comment.