@convertkit/editor-links
Advanced tools
Comparing version 0.2.3 to 0.2.4
import React, { Component } from 'react'; | ||
import { getEventTransfer } from 'slate-react'; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
var _extends_1 = createCommonjsModule(function (module) { | ||
function _extends() { | ||
module.exports = _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
module.exports = _extends; | ||
}); | ||
function _defineProperty(obj, key, value) { | ||
@@ -41,20 +45,4 @@ if (key in obj) { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var defineProperty = _defineProperty; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectSpread(target) { | ||
@@ -72,3 +60,3 @@ for (var i = 1; i < arguments.length; i++) { | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
defineProperty(target, key, source[key]); | ||
}); | ||
@@ -80,33 +68,4 @@ } | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
var objectSpread = _objectSpread; | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -127,7 +86,7 @@ if (source == null) return {}; | ||
var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose; | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var target = objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
@@ -149,18 +108,4 @@ | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
var objectWithoutProperties = _objectWithoutProperties; | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
/** | ||
@@ -213,4 +158,111 @@ * Expose `isUrl`. | ||
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
var classCallCheck = _classCallCheck; | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
var createClass = _createClass; | ||
var _typeof_1 = createCommonjsModule(function (module) { | ||
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return _typeof2(obj); | ||
}; | ||
} else { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
module.exports = _typeof; | ||
}); | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
var assertThisInitialized = _assertThisInitialized; | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (_typeof_1(call) === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return assertThisInitialized(self); | ||
} | ||
var possibleConstructorReturn = _possibleConstructorReturn; | ||
var getPrototypeOf = createCommonjsModule(function (module) { | ||
function _getPrototypeOf(o) { | ||
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
module.exports = _getPrototypeOf; | ||
}); | ||
var setPrototypeOf = createCommonjsModule(function (module) { | ||
function _setPrototypeOf(o, p) { | ||
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
module.exports = _setPrototypeOf; | ||
}); | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) setPrototypeOf(subClass, superClass); | ||
} | ||
var inherits = _inherits; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var style = { | ||
@@ -228,3 +280,3 @@ border: 0, | ||
var VisuallyHidden = (function (props) { | ||
return React.createElement("div", _extends$1({ style: style }, props)); | ||
return React.createElement("div", _extends({ style: style }, props)); | ||
}); | ||
@@ -235,3 +287,3 @@ | ||
function (_Component) { | ||
_inherits(ToolbarMenu, _Component); | ||
inherits(ToolbarMenu, _Component); | ||
@@ -241,7 +293,7 @@ function ToolbarMenu(props) { | ||
_classCallCheck(this, ToolbarMenu); | ||
classCallCheck(this, ToolbarMenu); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ToolbarMenu).call(this, props)); | ||
_this = possibleConstructorReturn(this, getPrototypeOf(ToolbarMenu).call(this, props)); | ||
_defineProperty(_assertThisInitialized(_this), "handleChange", function (event) { | ||
defineProperty(assertThisInitialized(_this), "handleChange", function (event) { | ||
var href = event.target.value; | ||
@@ -254,3 +306,3 @@ | ||
_defineProperty(_assertThisInitialized(_this), "handleSubmit", function (event) { | ||
defineProperty(assertThisInitialized(_this), "handleSubmit", function (event) { | ||
event.preventDefault(); | ||
@@ -276,3 +328,3 @@ var href = _this.state.href; | ||
_createClass(ToolbarMenu, [{ | ||
createClass(ToolbarMenu, [{ | ||
key: "componentDidMount", | ||
@@ -326,3 +378,3 @@ value: function componentDidMount() { | ||
var href = _ref.href, | ||
attributes = _objectWithoutProperties(_ref, ["href"]); | ||
attributes = objectWithoutProperties(_ref, ["href"]); | ||
@@ -337,3 +389,3 @@ if (editor.value.selection.isCollapsed) { | ||
editor.wrapLink(_objectSpread({ | ||
editor.wrapLink(objectSpread({ | ||
href: href | ||
@@ -345,7 +397,7 @@ }, attributes)); | ||
var href = _ref2.href, | ||
attributes = _objectWithoutProperties(_ref2, ["href"]); | ||
attributes = objectWithoutProperties(_ref2, ["href"]); | ||
editor.wrapInline({ | ||
type: "link", | ||
data: _objectSpread({ | ||
data: objectSpread({ | ||
href: href | ||
@@ -392,3 +444,4 @@ }, attributes) | ||
case "link": | ||
return React.createElement("a", _extends({}, attributes, { | ||
return React.createElement("a", _extends_1({}, attributes, { | ||
className: "email-link", | ||
href: node.data.get("href") | ||
@@ -395,0 +448,0 @@ }), children); |
@@ -11,24 +11,28 @@ 'use strict'; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
var _extends_1 = createCommonjsModule(function (module) { | ||
function _extends() { | ||
module.exports = _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
module.exports = _extends; | ||
}); | ||
function _defineProperty(obj, key, value) { | ||
@@ -49,20 +53,4 @@ if (key in obj) { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var defineProperty = _defineProperty; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectSpread(target) { | ||
@@ -80,3 +68,3 @@ for (var i = 1; i < arguments.length; i++) { | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
defineProperty(target, key, source[key]); | ||
}); | ||
@@ -88,33 +76,4 @@ } | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
var objectSpread = _objectSpread; | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -135,7 +94,7 @@ if (source == null) return {}; | ||
var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose; | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var target = objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
@@ -157,18 +116,4 @@ | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
var objectWithoutProperties = _objectWithoutProperties; | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
/** | ||
@@ -221,4 +166,111 @@ * Expose `isUrl`. | ||
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
var classCallCheck = _classCallCheck; | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
var createClass = _createClass; | ||
var _typeof_1 = createCommonjsModule(function (module) { | ||
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return _typeof2(obj); | ||
}; | ||
} else { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
module.exports = _typeof; | ||
}); | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
var assertThisInitialized = _assertThisInitialized; | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (_typeof_1(call) === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return assertThisInitialized(self); | ||
} | ||
var possibleConstructorReturn = _possibleConstructorReturn; | ||
var getPrototypeOf = createCommonjsModule(function (module) { | ||
function _getPrototypeOf(o) { | ||
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
module.exports = _getPrototypeOf; | ||
}); | ||
var setPrototypeOf = createCommonjsModule(function (module) { | ||
function _setPrototypeOf(o, p) { | ||
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
module.exports = _setPrototypeOf; | ||
}); | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) setPrototypeOf(subClass, superClass); | ||
} | ||
var inherits = _inherits; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var style = { | ||
@@ -236,3 +288,3 @@ border: 0, | ||
var VisuallyHidden = (function (props) { | ||
return React__default.createElement("div", _extends$1({ style: style }, props)); | ||
return React__default.createElement("div", _extends({ style: style }, props)); | ||
}); | ||
@@ -243,3 +295,3 @@ | ||
function (_Component) { | ||
_inherits(ToolbarMenu, _Component); | ||
inherits(ToolbarMenu, _Component); | ||
@@ -249,7 +301,7 @@ function ToolbarMenu(props) { | ||
_classCallCheck(this, ToolbarMenu); | ||
classCallCheck(this, ToolbarMenu); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ToolbarMenu).call(this, props)); | ||
_this = possibleConstructorReturn(this, getPrototypeOf(ToolbarMenu).call(this, props)); | ||
_defineProperty(_assertThisInitialized(_this), "handleChange", function (event) { | ||
defineProperty(assertThisInitialized(_this), "handleChange", function (event) { | ||
var href = event.target.value; | ||
@@ -262,3 +314,3 @@ | ||
_defineProperty(_assertThisInitialized(_this), "handleSubmit", function (event) { | ||
defineProperty(assertThisInitialized(_this), "handleSubmit", function (event) { | ||
event.preventDefault(); | ||
@@ -284,3 +336,3 @@ var href = _this.state.href; | ||
_createClass(ToolbarMenu, [{ | ||
createClass(ToolbarMenu, [{ | ||
key: "componentDidMount", | ||
@@ -334,3 +386,3 @@ value: function componentDidMount() { | ||
var href = _ref.href, | ||
attributes = _objectWithoutProperties(_ref, ["href"]); | ||
attributes = objectWithoutProperties(_ref, ["href"]); | ||
@@ -345,3 +397,3 @@ if (editor.value.selection.isCollapsed) { | ||
editor.wrapLink(_objectSpread({ | ||
editor.wrapLink(objectSpread({ | ||
href: href | ||
@@ -353,7 +405,7 @@ }, attributes)); | ||
var href = _ref2.href, | ||
attributes = _objectWithoutProperties(_ref2, ["href"]); | ||
attributes = objectWithoutProperties(_ref2, ["href"]); | ||
editor.wrapInline({ | ||
type: "link", | ||
data: _objectSpread({ | ||
data: objectSpread({ | ||
href: href | ||
@@ -400,3 +452,4 @@ }, attributes) | ||
case "link": | ||
return React__default.createElement("a", _extends({}, attributes, { | ||
return React__default.createElement("a", _extends_1({}, attributes, { | ||
className: "email-link", | ||
href: node.data.get("href") | ||
@@ -403,0 +456,0 @@ }), children); |
{ | ||
"name": "@convertkit/editor-links", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A plugin for handling links in the ConvertKit Editor", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "e567b1ab244df72421e5c90429967f558db43578" | ||
"gitHead": "fceee033d69d245f2102dac8a2c8b8aaa2865144" | ||
} |
@@ -61,3 +61,7 @@ import React from "react"; | ||
return ( | ||
<a {...attributes} href={node.data.get("href")}> | ||
<a | ||
{...attributes} | ||
className="email-link" | ||
href={node.data.get("href")} | ||
> | ||
{children} | ||
@@ -64,0 +68,0 @@ </a> |
28491
876