Skip to content

Commit

Permalink
Merge pull request #32 from Slid-Team/slid-release/1.1.4
Browse files Browse the repository at this point in the history
Slid release/1.1.4
  • Loading branch information
somangoi authored Jun 7, 2022
2 parents 7b6f562 + 53953ef commit 2eb6865
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/editor.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/components/inline-tools/inline-tool-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ export default class LinkInlineTool implements InlineTool {
/** Create blue background instead of selection */
this.selection.setFakeBackground();
this.selection.save();
inlineToolbarElement.style.transform = "translate(-50%, -33px)";
} else {
this.selection.restore();
this.selection.removeFakeBackground();
inlineToolbarElement.style.transform = "";
}
const parentAnchor = this.selection.findParentTag("A");
/**
Expand All @@ -186,7 +184,6 @@ export default class LinkInlineTool implements InlineTool {
this.nodes.button.classList.remove(this.CSS.buttonActive);
unlinkButton.remove();
this.inlineToolbar.close();
inlineToolbarElement.style.transform = "";

return;
}
Expand Down Expand Up @@ -216,7 +213,6 @@ export default class LinkInlineTool implements InlineTool {
this.nodes.button.classList.remove(this.CSS.buttonActive);
unlinkButton.remove();
this.inlineToolbar.close();
inlineToolbarElement.style.transform = "";
});

if (anchorTag) {
Expand Down Expand Up @@ -274,7 +270,12 @@ export default class LinkInlineTool implements InlineTool {
* @param {boolean} needFocus - on link creation we need to focus input. On editing - nope.
*/
private openActions(needFocus = false): void {
const inlineToolbarElement = document.getElementsByClassName(
"ce-inline-toolbar"
)[0] as HTMLDivElement;

this.nodes.input.classList.add(this.CSS.inputShowed);
inlineToolbarElement.style.transform = "translate(-50%, -33px)";
if (needFocus) {
this.nodes.input.focus();
}
Expand All @@ -288,6 +289,10 @@ export default class LinkInlineTool implements InlineTool {
* on toggle-clicks on the icon of opened Toolbar
*/
private closeActions(clearSavedSelection = true): void {
const inlineToolbarElement = document.getElementsByClassName(
"ce-inline-toolbar"
)[0] as HTMLDivElement;

if (this.selection.isFakeBackgroundEnabled) {
// if actions is broken by other selection We need to save new selection
const currentSelection = new SelectionUtils();
Expand All @@ -302,6 +307,7 @@ export default class LinkInlineTool implements InlineTool {
}

this.nodes.input.classList.remove(this.CSS.inputShowed);
inlineToolbarElement.style.transform = "";
this.nodes.input.value = "";
if (clearSavedSelection) {
this.selection.clearSaved();
Expand Down
2 changes: 1 addition & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.1.3"
"version": "1.1.4"
}

0 comments on commit 2eb6865

Please sign in to comment.