jldiaz_copy-protocol-plugin/styles.css

95 lines
3.3 KiB
CSS

/*
* Visual indicator for obsidian://copy protocol links.
*/
/* ── Reading View (Standard Links) ── */
/*
* We target the same pseudo-element Obsidian uses (::after) but with higher
* specificity to override it completely without !important.
*/
.markdown-rendered a.external-link[href^="obsidian://copy"],
.markdown-preview-view a.external-link[href^="obsidian://copy"] {
background-image: none;
padding-inline-end: 0;
}
.markdown-rendered a.external-link[href^="obsidian://copy"]::after,
.markdown-preview-view a.external-link[href^="obsidian://copy"]::after {
content: "";
display: inline-block;
width: 0.85em;
height: 0.85em;
margin-left: 5px;
vertical-align: middle;
background-color: currentColor;
background-image: none; /* Clears Obsidian's default icon if set via background-image */
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
opacity: 0.8;
}
.markdown-rendered a.external-link[href^="obsidian://copy"]:hover::after,
.markdown-preview-view a.external-link[href^="obsidian://copy"]:hover::after {
opacity: 1;
}
/* Hide Obsidian's default external link icon elements in Reading Mode */
.markdown-rendered a[href^="obsidian://copy"] .external-link,
.markdown-rendered a[href^="obsidian://copy"] + .external-link,
.markdown-preview-view a[href^="obsidian://copy"] .external-link,
.markdown-preview-view a[href^="obsidian://copy"] + .external-link {
display: none;
}
/* ── Live Preview (Managed by ViewPlugin Widget) ── */
/*
* Hide Obsidian's default external link icon on our copy links.
* Instead of :has(), we use the .has-copy-protocol-line class added in JS.
*/
.markdown-source-view.mod-cm6 .has-copy-protocol-line .external-link,
.markdown-source-view.mod-cm6 .has-copy-protocol-line .cm-url.external-link {
display: none;
}
/* Ensure the link text looks like a link */
.markdown-source-view.mod-cm6 .copy-protocol-link {
text-decoration: underline;
text-underline-offset: 2px;
}
/* Copy cursor on hover */
.markdown-source-view.mod-cm6 .copy-protocol-link:hover,
.markdown-source-view.mod-cm6 a[href^="obsidian://copy"]:hover {
cursor: copy;
}
/* ── Widget Styles (Live Preview) ── */
.copy-protocol-icon {
cursor: copy;
display: inline-flex;
margin-left: 5px;
vertical-align: middle;
opacity: 0.8;
transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}
.copy-protocol-icon:hover {
opacity: 1;
}
.copy-protocol-icon svg {
width: 0.85em;
height: 0.85em;
}
.copy-protocol-icon.is-clicked {
transform: scale(1.2);
}