mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added support for removing copy-to-clipboard button
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -16,5 +16,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'assets/javascripts/custom.f37eceaf.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/custom.a42114f4.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -245,7 +245,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.4ef4f6b1.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.bde97ade.min.js' | url }}"></script>
|
||||||
{% for path in config.extra_javascript %}
|
{% for path in config.extra_javascript %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ theme:
|
|||||||
features:
|
features:
|
||||||
# - announce.dismiss
|
# - announce.dismiss
|
||||||
- content.code.annotate
|
- content.code.annotate
|
||||||
|
- content.code.copy
|
||||||
# - content.tabs.link
|
# - content.tabs.link
|
||||||
- content.tooltips
|
- content.tooltips
|
||||||
# - header.autohide
|
# - header.autohide
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -66,7 +66,7 @@
|
|||||||
"stylelint-config-recommended": "^9.0.0",
|
"stylelint-config-recommended": "^9.0.0",
|
||||||
"stylelint-config-standard-scss": "^6.1.0",
|
"stylelint-config-standard-scss": "^6.1.0",
|
||||||
"stylelint-scss": "^4.3.0",
|
"stylelint-scss": "^4.3.0",
|
||||||
"svgo": "3.0.0",
|
"svgo": "^3.0.0",
|
||||||
"tiny-glob": "^0.2.9",
|
"tiny-glob": "^0.2.9",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.8.4"
|
"typescript": "^4.8.4"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { getElement, getLocation } from "~/browser"
|
|||||||
export type Flag =
|
export type Flag =
|
||||||
| "announce.dismiss" /* Dismissable announcement bar */
|
| "announce.dismiss" /* Dismissable announcement bar */
|
||||||
| "content.code.annotate" /* Code annotations */
|
| "content.code.annotate" /* Code annotations */
|
||||||
|
| "content.code.copy" /* Code copy button */
|
||||||
| "content.lazy" /* Lazy content elements */
|
| "content.lazy" /* Lazy content elements */
|
||||||
| "content.tabs.link" /* Link content tabs */
|
| "content.tabs.link" /* Link content tabs */
|
||||||
| "header.autohide" /* Hide header */
|
| "header.autohide" /* Hide header */
|
||||||
|
|||||||
@@ -173,12 +173,16 @@ export function mountCodeBlock(
|
|||||||
|
|
||||||
/* Render button for Clipboard.js integration */
|
/* Render button for Clipboard.js integration */
|
||||||
if (ClipboardJS.isSupported()) {
|
if (ClipboardJS.isSupported()) {
|
||||||
const parent = el.closest("pre")!
|
if (el.closest(".copy") || (
|
||||||
parent.id = `__code_${++sequence}`
|
feature("content.code.copy") && !el.closest(".no-copy")
|
||||||
parent.insertBefore(
|
)) {
|
||||||
renderClipboardButton(parent.id),
|
const parent = el.closest("pre")!
|
||||||
el
|
parent.id = `__code_${++sequence}`
|
||||||
)
|
parent.insertBefore(
|
||||||
|
renderClipboardButton(parent.id),
|
||||||
|
el
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle code annotations */
|
/* Handle code annotations */
|
||||||
|
|||||||
Reference in New Issue
Block a user