Skip to content

Commit

Permalink
fix copy in fixed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
parsagholipour committed Sep 24, 2023
1 parent 51c0865 commit 2b7bcfa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 22 deletions.
32 changes: 18 additions & 14 deletions dist/Sharee.55f9ad49.js → dist/Sharee.f3e8422a.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const p = {
drivers: ["copy", "telegram", "facebook", "whatsapp", "twitter", "linkedin"],
ripple: !0,
mode: "normal"
}, g = "rtl", E = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u062A\u0644\u06AF\u0631\u0627\u0645", f = "\u06A9\u067E\u06CC \u0644\u06CC\u0646\u06A9", C = "\u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u06A9\u067E\u06CC \u0634\u062F!", L = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0648\u0627\u062A\u0633\u0627\u067E", v = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u062A\u0648\u06CC\u06CC\u062A\u0631", w = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0644\u06CC\u0646\u06A9\u062F\u06CC\u0646", x = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0641\u06CC\u0633\u0628\u0648\u06A9", y = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0627\u06CC\u062A\u0627", h = {
}, g = "rtl", E = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u062A\u0644\u06AF\u0631\u0627\u0645", f = "\u06A9\u067E\u06CC \u0644\u06CC\u0646\u06A9", C = "\u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u06A9\u067E\u06CC \u0634\u062F!", v = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0648\u0627\u062A\u0633\u0627\u067E", L = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u062A\u0648\u06CC\u06CC\u062A\u0631", w = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0644\u06CC\u0646\u06A9\u062F\u06CC\u0646", x = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0641\u06CC\u0633\u0628\u0648\u06A9", y = "\u0627\u0634\u062A\u0631\u0627\u06A9 \u062F\u0631 \u0627\u06CC\u062A\u0627", h = {
Direction: g,
Telegram: E,
Copy_Link: f,
CopiedSuccessfully: C,
Whatsapp: L,
Twitter: v,
Whatsapp: v,
Twitter: L,
Linkedin: w,
Facebook: x,
Eitaa: y
Expand All @@ -26,8 +26,8 @@ const p = {
Telegram: E,
Copy_Link: f,
CopiedSuccessfully: C,
Whatsapp: L,
Twitter: v,
Whatsapp: v,
Twitter: L,
Linkedin: w,
Facebook: x,
Eitaa: y,
Expand Down Expand Up @@ -388,12 +388,16 @@ class O extends d {
}));
}
renderDriver(e) {
e.mainEl = document.createElement("a"), "getLink" in e && (e.mainEl.href = e.getLink()), this.initDriverStyles(e);
e.mainEl = document.createElement("a"), "getLink" in e && (e.mainEl.href = e.getLink()), this.initDriverStyles(e), this.listenDriverEvents(e);
const t = document.createElement("div");
t.innerHTML = e.icon;
const i = document.createElement("div");
return i.innerHTML = e.getButtonText(), e.mainEl.appendChild(t), this.options.noTitle ? (e.mainEl.title = e.getButtonText(), e.mainEl.classList.add("sharee__no-title")) : e.mainEl.appendChild(i), e.mainEl.classList.add("sharee__driver__" + e.getName()), e.mainEl;
}
listenDriverEvents(e) {
const t = this.onDriverClick(e);
this.driverListeners[e.buttonText] = [t], e.mainEl.addEventListener("click", t);
}
}
class z extends u {
constructor(s) {
Expand Down Expand Up @@ -502,7 +506,7 @@ class P extends a {
}
getLink() {
var e, t;
return `whatsapp://send?text=${(e = this.options) == null ? void 0 : e.shareText}
return `https://wa.me?text=${(e = this.options) == null ? void 0 : e.shareText}
${(t = this.options) == null ? void 0 : t.shareLink}`;
}
}
Expand Down Expand Up @@ -561,24 +565,24 @@ class W extends a {
}
getLink() {
var e, t;
return `https://twitter.com/share?text=${encodeURIComponent((e = this.options) == null ? void 0 : e.shareText)}&url=${(t = this.options) == null ? void 0 : t.shareLink}`;
return `https://twitter.com/intent/tweet?text=${encodeURIComponent((e = this.options) == null ? void 0 : e.shareText)}&url=${(t = this.options) == null ? void 0 : t.shareLink}`;
}
}
const U = `<svg fill="currentColor" width="32px" height="32px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M 8.6425781 4 C 7.1835781 4 6 5.181625 6 6.640625 C 6 8.099625 7.182625 9.3085938 8.640625 9.3085938 C 10.098625 9.3085938 11.283203 8.099625 11.283203 6.640625 C 11.283203 5.182625 10.101578 4 8.6425781 4 z M 21.535156 11 C 19.316156 11 18.0465 12.160453 17.4375 13.314453 L 17.373047 13.314453 L 17.373047 11.310547 L 13 11.310547 L 13 26 L 17.556641 26 L 17.556641 18.728516 C 17.556641 16.812516 17.701266 14.960938 20.072266 14.960938 C 22.409266 14.960937 22.443359 17.145609 22.443359 18.849609 L 22.443359 26 L 26.994141 26 L 27 26 L 27 17.931641 C 27 13.983641 26.151156 11 21.535156 11 z M 6.3632812 11.310547 L 6.3632812 26 L 10.923828 26 L 10.923828 11.310547 L 6.3632812 11.310547 z"/></svg>\r
const A = `<svg fill="currentColor" width="32px" height="32px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M 8.6425781 4 C 7.1835781 4 6 5.181625 6 6.640625 C 6 8.099625 7.182625 9.3085938 8.640625 9.3085938 C 10.098625 9.3085938 11.283203 8.099625 11.283203 6.640625 C 11.283203 5.182625 10.101578 4 8.6425781 4 z M 21.535156 11 C 19.316156 11 18.0465 12.160453 17.4375 13.314453 L 17.373047 13.314453 L 17.373047 11.310547 L 13 11.310547 L 13 26 L 17.556641 26 L 17.556641 18.728516 C 17.556641 16.812516 17.701266 14.960938 20.072266 14.960938 C 22.409266 14.960937 22.443359 17.145609 22.443359 18.849609 L 22.443359 26 L 26.994141 26 L 27 26 L 27 17.931641 C 27 13.983641 26.151156 11 21.535156 11 z M 6.3632812 11.310547 L 6.3632812 26 L 10.923828 26 L 10.923828 11.310547 L 6.3632812 11.310547 z"/></svg>\r
`;
class A extends a {
class U extends a {
constructor(e, t) {
super(e, t);
n(this, "buttonText", "Linkedin");
n(this, "icon", U);
n(this, "icon", A);
n(this, "backgroundColor", "#0077B5");
n(this, "backgroundHoverColor", "#026092");
n(this, "textColor", "#fff");
n(this, "textHoverColor", "#fff");
}
getLink() {
var e;
return `https://www.linkedin.com/sharing/share-offsite/?url=${(e = this.options) == null ? void 0 : e.shareLink}`;
return `https://www.linkedin.com/shareArticle?url=${(e = this.options) == null ? void 0 : e.shareLink}`;
}
}
const X = `<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">\r
Expand All @@ -597,7 +601,7 @@ class G extends a {
}
getLink() {
var e, t;
return `https://twitter.com/share?text=${encodeURIComponent((e = this.options) == null ? void 0 : e.shareText)}&url=${(t = this.options) == null ? void 0 : t.shareLink}`;
return `https://facebook.com/sharer/sharer.php?u=${(e = this.options) == null ? void 0 : e.shareLink}&t=${encodeURIComponent((t = this.options) == null ? void 0 : t.shareText)}`;
}
}
const q = `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="-2.4 -2.4 28.80 28.80" role="img">\r
Expand Down Expand Up @@ -627,7 +631,7 @@ const J = new Object({
whatsapp: P,
copy: F,
twitter: W,
linkedin: A,
linkedin: U,
facebook: G,
eitaa: Z
});
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee-react.js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRef as n, useEffect as u } from "react";
import { S as o } from "./Sharee.55f9ad49.js";
import { S as o } from "./Sharee.f3e8422a.js";
import { jsx as f } from "react/jsx-runtime";
import "lodash.merge";
function m(e) {
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee-vue.js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent as a, ref as o, onMounted as u, onUnmounted as s, openBlock as p, createElementBlock as i } from "vue";
import { S as m } from "./Sharee.55f9ad49.js";
import { S as m } from "./Sharee.f3e8422a.js";
import "lodash.merge";
const _ = /* @__PURE__ */ a({
__name: "Sharee",
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { S as a } from "./Sharee.55f9ad49.js";
import { S as a } from "./Sharee.f3e8422a.js";
import "lodash.merge";
export {
a as default
Expand Down
10 changes: 5 additions & 5 deletions dist/sharee.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/lib/strategies/FixedStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export default class FixedStrategy extends BaseStrategy {
driver.mainEl.href = driver.getLink();
}
this.initDriverStyles(driver);
this.listenDriverEvents(driver);
const icon = document.createElement('div');
icon.innerHTML = driver.icon;
const text = document.createElement('div');
Expand All @@ -135,4 +136,10 @@ export default class FixedStrategy extends BaseStrategy {

return driver.mainEl;
}

protected listenDriverEvents(driver: Driver) {
const onDriverClick = this.onDriverClick(driver)
this.driverListeners[driver.buttonText] = [onDriverClick]
driver.mainEl!.addEventListener('click', onDriverClick);
}
}

0 comments on commit 2b7bcfa

Please sign in to comment.