PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
yaymail / assets / scripts / wp-editor-plugins / autolink / plugin.min.js

plugin.min.js in YayMail – WooCommerce Email Customizer 4.4.5, at assets/scripts/wp-editor-plugins/autolink/plugin.min.js

109 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 !(function () {
2 'use strict';
3 var e = tinymce.util.Tools.resolve('tinymce.PluginManager'),
4 i = tinymce.util.Tools.resolve('tinymce.Env'),
5 m = function (e) {
6 return e.getParam(
7 'autolink_pattern',
8 /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i,
9 );
10 },
11 y = function (e) {
12 return e.getParam('default_link_target', '');
13 },
14 o = function (e, t) {
15 if ((t < 0 && (t = 0), 3 === e.nodeType)) {
16 var n = e.data.length;
17 n < t && (t = n);
18 }
19 return t;
20 },
21 k = function (e, t, n) {
22 1 !== t.nodeType || t.hasChildNodes() ? e.setStart(t, o(t, n)) : e.setStartBefore(t);
23 },
24 p = function (e, t, n) {
25 1 !== t.nodeType || t.hasChildNodes() ? e.setEnd(t, o(t, n)) : e.setEndAfter(t);
26 },
27 r = function (e, t, n) {
28 var i,
29 o,
30 r,
31 a,
32 f,
33 s,
34 d,
35 l,
36 c,
37 u,
38 g = m(e),
39 h = y(e);
40 if ('A' !== e.selection.getNode().tagName) {
41 if ((i = e.selection.getRng(!0).cloneRange()).startOffset < 5) {
42 if (!(l = i.endContainer.previousSibling)) {
43 if (!i.endContainer.firstChild || !i.endContainer.firstChild.nextSibling) return;
44 l = i.endContainer.firstChild.nextSibling;
45 }
46 if (((c = l.length), k(i, l, c), p(i, l, c), i.endOffset < 5)) return;
47 (o = i.endOffset), (a = l);
48 } else {
49 if (3 !== (a = i.endContainer).nodeType && a.firstChild) {
50 for (; 3 !== a.nodeType && a.firstChild; ) a = a.firstChild;
51 3 === a.nodeType && (k(i, a, 0), p(i, a, a.nodeValue.length));
52 }
53 o = 1 === i.endOffset ? 2 : i.endOffset - 1 - t;
54 }
55 for (
56 r = o;
57 k(i, a, 2 <= o ? o - 2 : 0),
58 p(i, a, 1 <= o ? o - 1 : 0),
59 (o -= 1),
60 ' ' !== (u = i.toString()) &&
61 '' !== u &&
62 160 !== u.charCodeAt(0) &&
63 0 <= o - 2 &&
64 u !== n;
65
66 );
67 var C;
68 (C = i.toString()) === n || ' ' === C || 160 === C.charCodeAt(0)
69 ? (k(i, a, o), p(i, a, r), (o += 1))
70 : (0 === i.startOffset ? k(i, a, 0) : k(i, a, o), p(i, a, r)),
71 '.' === (s = i.toString()).charAt(s.length - 1) && p(i, a, r - 1),
72 (d = (s = i.toString().trim()).match(g)) &&
73 ('www.' === d[1]
74 ? (d[1] = 'http://www.')
75 : /@$/.test(d[1]) && !/^mailto:/.test(d[1]) && (d[1] = 'mailto:' + d[1]),
76 (f = e.selection.getBookmark()),
77 e.selection.setRng(i),
78 e.execCommand('createlink', !1, d[1] + d[2]),
79 h && e.dom.setAttrib(e.selection.getNode(), 'target', h),
80 e.selection.moveToBookmark(f),
81 e.nodeChanged());
82 }
83 },
84 t = function (t) {
85 var n;
86 t.on('keydown', function (e) {
87 13 !== e.keyCode || r(t, -1, '');
88 }),
89 i.ie
90 ? t.on('focus', function () {
91 if (!n) {
92 n = !0;
93 try {
94 t.execCommand('AutoUrlDetect', !1, !0);
95 } catch (e) {}
96 }
97 })
98 : (t.on('keypress', function (e) {
99 41 !== e.keyCode || r(t, -1, '(');
100 }),
101 t.on('keyup', function (e) {
102 32 !== e.keyCode || r(t, 0, '');
103 }));
104 };
105 e.add('autolink', function (e) {
106 t(e);
107 });
108 })();
109