diff --git a/src/components/EditorContent/utils/headers.js b/src/components/EditorContent/utils/headers.js index 8e29a635..8e804f18 100644 --- a/src/components/EditorContent/utils/headers.js +++ b/src/components/EditorContent/utils/headers.js @@ -35,7 +35,7 @@ export const buildHeaderLinks = editorContentNode => { const usedIds = new Map(); headerTags.forEach(heading => { - if (heading.getAttribute('data-link') === 'false') { + if (heading.getAttribute("data-link") === "false") { return; } @@ -48,12 +48,16 @@ export const buildHeaderLinks = editorContentNode => { heading.setAttribute("id", headingId); + const wrapper = document.createElement("div"); const anchor = document.createElement("a"); + + wrapper.classList.add("header-wrapper"); anchor.setAttribute("href", `#${headingId}`); - anchor.classList.add("header-wrapper-link"); + anchor.classList.add("header-wrapper__link"); anchor.appendChild(buildLinkSVG()); - anchor.appendChild(heading.cloneNode(true)); - heading.replaceWith(anchor); + wrapper.appendChild(heading.cloneNode(true)); + wrapper.appendChild(anchor); + heading.replaceWith(wrapper); }); }; diff --git a/src/styles/editor/editor-content.scss b/src/styles/editor/editor-content.scss index 0ad72858..edbd2377 100644 --- a/src/styles/editor/editor-content.scss +++ b/src/styles/editor/editor-content.scss @@ -440,9 +440,14 @@ } // header anchor tags - .header-wrapper-link { + .header-wrapper { position: relative; + &__link { + position: absolute; + top: 50%; + } + h1, h2, h3, @@ -470,15 +475,6 @@ } &:hover { - h1, - h2, - h3, - h4, - h5, - h6 { - color: rgb(var(--neeto-editor-accent-800)); - } - .header-link-icon-wrapper { opacity: 1; }