@pie-lib/editable-html 7.17.4-next.59 → 7.17.4-next.595
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +135 -0
- package/CHANGELOG.md +421 -0
- package/lib/editor.js +392 -172
- package/lib/editor.js.map +1 -1
- package/lib/index.js +66 -53
- package/lib/index.js.map +1 -1
- package/lib/parse-html.js.map +1 -1
- package/lib/plugins/characters/custom-popper.js +73 -0
- package/lib/plugins/characters/custom-popper.js.map +1 -0
- package/lib/plugins/characters/index.js +285 -0
- package/lib/plugins/characters/index.js.map +1 -0
- package/lib/plugins/characters/utils.js +381 -0
- package/lib/plugins/characters/utils.js.map +1 -0
- package/lib/plugins/image/alt-dialog.js +119 -0
- package/lib/plugins/image/alt-dialog.js.map +1 -0
- package/lib/plugins/image/component.js +253 -77
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/image/image-toolbar.js +95 -61
- package/lib/plugins/image/image-toolbar.js.map +1 -1
- package/lib/plugins/image/index.js +62 -20
- package/lib/plugins/image/index.js.map +1 -1
- package/lib/plugins/image/insert-image-handler.js +9 -15
- package/lib/plugins/image/insert-image-handler.js.map +1 -1
- package/lib/plugins/index.js +20 -12
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/list/index.js +82 -14
- package/lib/plugins/list/index.js.map +1 -1
- package/lib/plugins/math/index.js +50 -55
- package/lib/plugins/math/index.js.map +1 -1
- package/lib/plugins/media/index.js +71 -27
- package/lib/plugins/media/index.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +274 -74
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +26 -30
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/media/media-wrapper.js +28 -35
- package/lib/plugins/media/media-wrapper.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +68 -46
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +12 -12
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +10 -9
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +11 -11
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/index.js +58 -42
- package/lib/plugins/respArea/index.js.map +1 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +8 -8
- package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js +5 -5
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/icons/index.js +12 -12
- package/lib/plugins/table/icons/index.js.map +1 -1
- package/lib/plugins/table/index.js +83 -27
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/table-toolbar.js +41 -50
- package/lib/plugins/table/table-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/default-toolbar.js +19 -13
- package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/done-button.js +5 -5
- package/lib/plugins/toolbar/done-button.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +62 -45
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +6 -5
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +49 -52
- package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
- package/lib/plugins/toolbar/toolbar.js +64 -62
- package/lib/plugins/toolbar/toolbar.js.map +1 -1
- package/lib/plugins/utils.js +1 -1
- package/lib/plugins/utils.js.map +1 -1
- package/lib/serialization.js +32 -9
- package/lib/serialization.js.map +1 -1
- package/lib/theme.js.map +1 -1
- package/package.json +7 -6
- package/src/editor.jsx +226 -26
- package/src/index.jsx +22 -5
- package/src/plugins/characters/custom-popper.js +48 -0
- package/src/plugins/characters/index.jsx +268 -0
- package/src/plugins/characters/utils.js +447 -0
- package/src/plugins/image/alt-dialog.jsx +69 -0
- package/src/plugins/image/component.jsx +204 -21
- package/src/plugins/image/image-toolbar.jsx +68 -22
- package/src/plugins/image/index.jsx +47 -9
- package/src/plugins/index.jsx +4 -1
- package/src/plugins/list/index.jsx +67 -5
- package/src/plugins/math/index.jsx +31 -37
- package/src/plugins/media/index.jsx +49 -6
- package/src/plugins/media/media-dialog.js +285 -89
- package/src/plugins/media/media-toolbar.jsx +7 -4
- package/src/plugins/respArea/drag-in-the-blank/choice.jsx +28 -1
- package/src/plugins/respArea/explicit-constructed-response/index.jsx +3 -3
- package/src/plugins/respArea/index.jsx +50 -31
- package/src/plugins/table/index.jsx +63 -14
- package/src/plugins/toolbar/default-toolbar.jsx +20 -2
- package/src/plugins/toolbar/editor-and-toolbar.jsx +50 -11
- package/src/plugins/toolbar/index.jsx +1 -0
- package/src/plugins/toolbar/toolbar-buttons.jsx +13 -2
- package/src/plugins/toolbar/toolbar.jsx +18 -3
- package/src/serialization.jsx +19 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["spanishConfig","characters","specialConfig","hasPreview","unicode","description","write","label","extraProps","style","gridRow","String","fromCodePoint","characterIcons","spanish","special"],"sources":["../../../src/plugins/characters/utils.js"],"sourcesContent":["export const spanishConfig = {\n characters: [\n ['á', 'é', 'í', 'ó', 'ú'],\n ['Á', 'É', 'Í', 'Ó', 'Ú'],\n ['—', '«', '»', 'ñ', 'ü'],\n ['-', '¿', '¡', 'Ñ', 'Ü']\n ]\n};\n\nexport const specialConfig = {\n hasPreview: true,\n characters: [\n [\n {\n unicode: 'U+00A2',\n description: 'CENT SIGN',\n write: '¢',\n label: '¢'\n },\n {\n unicode: 'U+00BF',\n description: 'INVERTED QUESTION MARK',\n write: '¿',\n label: '¿'\n },\n {\n unicode: 'U+00B4',\n description: 'ACUTE ACCENT',\n write: '´',\n label: '´',\n extraProps: { style: { gridRow: 'span 2' } }\n },\n {\n unicode: 'U+00E1',\n description: 'LATIN SMALL LETTER A WITH ACUTE',\n write: 'á',\n label: 'á'\n },\n {\n unicode: 'U+00E9',\n description: 'LATIN SMALL LETTER E WITH ACUTE',\n write: 'é',\n label: 'é'\n },\n {\n unicode: 'U+00ED',\n description: 'LATIN SMALL LETTER I WITH ACUTE',\n write: 'í',\n label: 'í'\n },\n {\n unicode: 'U+00F3',\n description: 'LATIN SMALL LETTER O WITH ACUTE',\n write: 'ó',\n label: 'ó'\n },\n {\n unicode: 'U+00FA',\n description: 'LATIN SMALL LETTER U WITH ACUTE',\n write: 'ú',\n label: 'ú'\n },\n {\n unicode: 'U+00F1',\n description: 'LATIN SMALL LETTER N WITH TILDE',\n write: 'ñ',\n label: 'ñ'\n }\n ],\n [\n {\n unicode: 'U+20AC',\n description: 'EURO SIGN',\n write: '€',\n label: '€'\n },\n {\n unicode: 'U+00A1',\n description: 'INVERTED EXCLAMATION MARK',\n write: '¡',\n label: '¡'\n },\n {\n unicode: 'U+00C1',\n description: 'LATIN CAPITAL LETTER A WITH ACUTE',\n write: 'Á',\n label: 'Á'\n },\n {\n unicode: 'U+00C9',\n description: 'LATIN CAPITAL LETTER E WITH ACUTE',\n write: 'É',\n label: 'É'\n },\n {\n unicode: 'U+00CD',\n description: 'LATIN CAPITAL LETTER I WITH ACUTE',\n write: 'Í',\n label: 'Í'\n },\n {\n unicode: 'U+00D3',\n description: 'LATIN CAPITAL LETTER O WITH ACUTE',\n write: 'Ó',\n label: 'Ó'\n },\n {\n unicode: 'U+00DA',\n description: 'LATIN CAPITAL LETTER U WITH ACUTE',\n write: 'Ú',\n label: 'Ú'\n },\n {\n unicode: 'U+00D1',\n description: 'LATIN CAPITAL LETTER N WITH TILDE',\n write: 'Ñ',\n label: 'Ñ'\n }\n ],\n [\n {\n unicode: 'U+00A3',\n description: 'POUND SIGN',\n write: '£',\n label: '£'\n },\n {\n unicode: 'U+00AB',\n description: 'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK',\n write: '«',\n label: '«'\n },\n {\n unicode: 'U+005E',\n description: 'CIRCUMFLEX ACCENT',\n write: '^',\n label: '^',\n extraProps: { style: { gridRow: 'span 2' } }\n },\n {\n unicode: 'U+00E2',\n description: 'LATIN SMALL LETTER A WITH CIRCUMFLEX',\n write: 'â',\n label: 'â'\n },\n {\n unicode: 'U+00EA',\n description: 'LATIN SMALL LETTER E WITH CIRCUMFLEX',\n write: 'ê',\n label: 'ê'\n },\n {\n unicode: 'U+00EE',\n description: 'LATIN SMALL LETTER I WITH CIRCUMFLEX',\n write: 'î',\n label: 'î'\n },\n {\n unicode: 'U+00F4',\n description: 'LATIN SMALL LETTER O WITH CIRCUMFLEX',\n write: 'ô',\n label: 'ô'\n },\n {\n unicode: 'U+00FB',\n description: 'LATIN SMALL LETTER U WITH CIRCUMFLEX',\n write: 'û',\n label: 'û'\n },\n {\n unicode: 'U+00E7',\n description: 'LATIN SMALL LETTER C WITH CEDILLA',\n write: 'ç',\n label: 'ç'\n }\n ],\n [\n {\n unicode: 'U+00A5',\n description: 'YEN SIGN',\n write: '¥',\n label: '¥'\n },\n {\n unicode: 'U+00BB',\n description: 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK',\n write: '»',\n label: '»'\n },\n {\n unicode: 'U+00C2',\n description: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX',\n write: 'Â',\n label: 'Â'\n },\n {\n unicode: 'U+00CA',\n description: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX',\n write: 'Ê',\n label: 'Ê'\n },\n {\n unicode: 'U+00CE',\n description: 'LATIN CAPITAL LETTER I WITH CIRCUMFLEX',\n write: 'Î',\n label: 'Î'\n },\n {\n unicode: 'U+00D4',\n description: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX',\n write: 'Ô',\n label: 'Ô'\n },\n {\n unicode: 'U+00DB',\n description: 'LATIN CAPITAL LETTER U WITH CIRCUMFLEX',\n write: 'Û',\n label: 'Û'\n },\n {\n unicode: 'U+00C7',\n description: 'LATIN CAPITAL LETTER C WITH CEDILLA',\n write: 'Ç',\n label: 'Ç'\n }\n ],\n [\n {\n unicode: 'U+00A0',\n description: 'NO-BREAK SPACE',\n write: String.fromCodePoint('0x00A0'),\n label: ' '\n },\n {\n unicode: 'U+00A7',\n description: 'SECTION SIGN',\n write: '§',\n label: '§'\n },\n {\n unicode: 'U+00A8',\n description: 'DIAERESIS',\n write: '¨',\n label: '¨',\n extraProps: { style: { gridRow: 'span 2' } }\n },\n {\n unicode: 'U+00E4',\n description: 'LATIN SMALL LETTER A WITH DIAERESIS',\n write: 'ä',\n label: 'ä'\n },\n {\n unicode: 'U+00EB',\n description: 'LATIN SMALL LETTER E WITH DIAERESIS',\n write: 'ë',\n label: 'ë'\n },\n {\n unicode: 'U+00EF',\n description: 'LATIN SMALL LETTER I WITH DIAERESIS',\n write: 'ï',\n label: 'ï'\n },\n {\n unicode: 'U+00F6',\n description: 'LATIN SMALL LETTER O WITH DIAERESIS',\n write: 'ö',\n label: 'ö'\n },\n {\n unicode: 'U+00FC',\n description: 'LATIN SMALL LETTER U WITH DIAERESIS',\n write: 'ü',\n label: 'ü'\n },\n {\n unicode: 'U+00DF',\n description: 'LATIN SMALL LETTER SHARP S',\n write: 'ß',\n label: 'ß'\n }\n ],\n [\n {\n unicode: 'U+2009',\n description: 'THIN SPACE',\n write: String.fromCodePoint('0x2009'),\n label: ' '\n },\n {\n unicode: 'U+2026',\n description: 'HORIZONTAL ELLIPSIS',\n write: '…',\n label: '…'\n },\n {\n unicode: 'U+00C4',\n description: 'LATIN CAPITAL LETTER A WITH DIAERESIS',\n write: 'Ä',\n label: 'Ä'\n },\n {\n unicode: 'U+00CB',\n description: 'LATIN CAPITAL LETTER E WITH DIAERESIS',\n write: 'Ë',\n label: 'Ë'\n },\n {\n unicode: 'U+00CF',\n description: 'LATIN CAPITAL LETTER I WITH DIAERESIS',\n write: 'Ï',\n label: 'Ï'\n },\n {\n unicode: 'U+00D6',\n description: 'LATIN CAPITAL LETTER O WITH DIAERESIS',\n write: 'Ö',\n label: 'Ö'\n },\n {\n unicode: 'U+00DC',\n description: 'LATIN CAPITAL LETTER U WITH DIAERESIS',\n write: 'Ü',\n label: 'Ü'\n },\n {\n unicode: 'U+2212',\n description: 'MINUS SIGN',\n write: '−',\n label: '−'\n }\n ],\n [\n {\n unicode: 'U+200A',\n description: 'HAIR SPACE',\n write: String.fromCodePoint('0x200A'),\n label: ' '\n },\n {\n unicode: 'U+2022',\n description: 'BULLET',\n write: '•',\n label: '•'\n },\n {\n unicode: 'U+0060',\n description: 'GRAVE ACCENT',\n write: '`',\n label: '`',\n extraProps: { style: { gridRow: 'span 2' } }\n },\n {\n unicode: 'U+00E0',\n description: 'LATIN SMALL LETTER A WITH GRAVE',\n write: 'à',\n label: 'à'\n },\n {\n unicode: 'U+00E8',\n description: 'LATIN SMALL LETTER E WITH GRAVE',\n write: 'è',\n label: 'è'\n },\n {\n unicode: 'U+00EC',\n description: 'LATIN SMALL LETTER I WITH GRAVE',\n write: 'ì',\n label: 'ì'\n },\n {\n unicode: 'U+00F2',\n description: 'LATIN SMALL LETTER O WITH GRAVE',\n write: 'ò',\n label: 'ò'\n },\n {\n unicode: 'U+00F9',\n description: 'LATIN SMALL LETTER U WITH GRAVE',\n write: 'ù',\n label: 'ù'\n },\n {\n unicode: 'U+2013',\n description: 'EN DASH',\n write: '–',\n label: '–'\n }\n ],\n [\n {\n unicode: 'U+0009',\n description: 'TAB',\n write: String.fromCodePoint('0x0009'),\n label: 'TAB'\n },\n {\n unicode: 'U+25E6',\n description: 'WHITE BULLET',\n write: '◦',\n label: '◦'\n },\n {\n unicode: 'U+00C0',\n description: 'LATIN CAPITAL LETTER A WITH GRAVE',\n write: 'À',\n label: 'À'\n },\n {\n unicode: 'U+00C8',\n description: 'LATIN CAPITAL LETTER E WITH GRAVE',\n write: 'È',\n label: 'È'\n },\n {\n unicode: 'U+00CC',\n description: 'LATIN CAPITAL LETTER I WITH GRAVE',\n write: 'Ì',\n label: 'Ì'\n },\n {\n unicode: 'U+00D2',\n description: 'LATIN CAPITAL LETTER O WITH GRAVE',\n write: 'Ò',\n label: 'Ò'\n },\n {\n unicode: 'U+00D9',\n description: 'LATIN CAPITAL LETTER U WITH GRAVE',\n write: 'Ù',\n label: 'Ù'\n },\n {\n unicode: 'U+2014',\n description: 'EM DASH',\n write: '—',\n label: '—'\n }\n ]\n ]\n};\n\nexport const characterIcons = {\n spanish: 'ñ',\n special: '€'\n};\n"],"mappings":";;;;;;AAAO,IAAMA,aAAa,GAAG;EAC3BC,UAAU,EAAE,CACV,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,EAAqB,GAArB,CADU,EAEV,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,EAAqB,GAArB,CAFU,EAGV,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,EAAqB,GAArB,CAHU,EAIV,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,EAAqB,GAArB,CAJU;AADe,CAAtB;;AASA,IAAMC,aAAa,GAAG;EAC3BC,UAAU,EAAE,IADe;EAE3BF,UAAU,EAAE,CACV,CACE;IACEG,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,WAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE;EAJT,CADF,EAOE;IACEH,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,wBAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE;EAJT,CAPF,EAaE;IACEH,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,cAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE,GAJT;IAKEC,UAAU,EAAE;MAAEC,KAAK,EAAE;QAAEC,OAAO,EAAE;MAAX;IAAT;EALd,CAbF,EAoBE;IACEN,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,iCAF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EA+BE;IACEH,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,mCAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE;EAJT,CA/BF,EAqCE;IACEH,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,mCAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE;EAJT,CArCF,EA2CE;IACEH,OAAO,EAAE,QADX;IAEEC,WAAW,EAAE,SAFf;IAGEC,KAAK,EAAE,GAHT;IAIEC,KAAK,EAAE;EAJT,CA3CF,CA3XU;AAFe,CAAtB;;AAkbA,IAAMM,cAAc,GAAG;EAC5BC,OAAO,EAAE,GADmB;EAE5BC,OAAO,EAAE;AAFmB,CAAvB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.AltDialog = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
|
|
26
|
+
var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
|
|
27
|
+
|
|
28
|
+
var _ArrowBackIos = _interopRequireDefault(require("@material-ui/icons/ArrowBackIos"));
|
|
29
|
+
|
|
30
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
31
|
+
|
|
32
|
+
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
33
|
+
|
|
34
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
35
|
+
|
|
36
|
+
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
37
|
+
|
|
38
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
39
|
+
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
|
+
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
|
|
44
|
+
var AltDialog = /*#__PURE__*/function (_React$Component) {
|
|
45
|
+
(0, _inherits2["default"])(AltDialog, _React$Component);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(AltDialog);
|
|
48
|
+
|
|
49
|
+
function AltDialog(props) {
|
|
50
|
+
var _this;
|
|
51
|
+
|
|
52
|
+
(0, _classCallCheck2["default"])(this, AltDialog);
|
|
53
|
+
_this = _super.call(this, props);
|
|
54
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeDialog", function () {
|
|
55
|
+
var allDialogs = document.querySelectorAll('#text-dialog');
|
|
56
|
+
allDialogs.forEach(function (s) {
|
|
57
|
+
return s.remove();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDone", function () {
|
|
61
|
+
var onDone = _this.props.onDone;
|
|
62
|
+
var value = _this.state.value;
|
|
63
|
+
onDone(value);
|
|
64
|
+
|
|
65
|
+
_this.closeDialog();
|
|
66
|
+
});
|
|
67
|
+
var alt = props.alt;
|
|
68
|
+
_this.state = {
|
|
69
|
+
value: alt
|
|
70
|
+
};
|
|
71
|
+
return _this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
(0, _createClass2["default"])(AltDialog, [{
|
|
75
|
+
key: "render",
|
|
76
|
+
value: function render() {
|
|
77
|
+
var _this2 = this;
|
|
78
|
+
|
|
79
|
+
var value = this.state.value;
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
81
|
+
open: true,
|
|
82
|
+
disablePortal: true,
|
|
83
|
+
onClose: this.closeDialog,
|
|
84
|
+
id: "text-dialog",
|
|
85
|
+
hideBackdrop: true
|
|
86
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
87
|
+
style: {
|
|
88
|
+
display: 'flex'
|
|
89
|
+
}
|
|
90
|
+
}, /*#__PURE__*/_react["default"].createElement(_ArrowBackIos["default"], {
|
|
91
|
+
style: {
|
|
92
|
+
paddingTop: '6px'
|
|
93
|
+
}
|
|
94
|
+
}), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
95
|
+
multiline: true,
|
|
96
|
+
placeholder: 'Enter an Alt Text description of this image',
|
|
97
|
+
helperText: 'Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.',
|
|
98
|
+
value: value,
|
|
99
|
+
onChange: function onChange(event) {
|
|
100
|
+
return _this2.setState({
|
|
101
|
+
value: event.target.value
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
105
|
+
onClick: this.onDone
|
|
106
|
+
}, "Done")));
|
|
107
|
+
}
|
|
108
|
+
}]);
|
|
109
|
+
return AltDialog;
|
|
110
|
+
}(_react["default"].Component);
|
|
111
|
+
|
|
112
|
+
exports.AltDialog = AltDialog;
|
|
113
|
+
(0, _defineProperty2["default"])(AltDialog, "propTypes", {
|
|
114
|
+
onDone: _propTypes["default"].func.isRequired,
|
|
115
|
+
alt: _propTypes["default"].string
|
|
116
|
+
});
|
|
117
|
+
var _default = AltDialog;
|
|
118
|
+
exports["default"] = _default;
|
|
119
|
+
//# sourceMappingURL=alt-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alt-dialog.js","names":["AltDialog","props","allDialogs","document","querySelectorAll","forEach","s","remove","onDone","value","state","closeDialog","alt","display","paddingTop","event","setState","target","React","Component","PropTypes","func","isRequired","string"],"sources":["../../../src/plugins/image/alt-dialog.jsx"],"sourcesContent":["import React from 'react';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport ArrowBackIos from '@material-ui/icons/ArrowBackIos';\nimport TextField from '@material-ui/core/TextField';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport PropTypes from \"prop-types\";\n\nexport class AltDialog extends React.Component {\n static propTypes = {\n onDone: PropTypes.func.isRequired,\n alt: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n const { alt } = props;\n\n this.state = {\n value: alt\n };\n }\n\n closeDialog = () => {\n const allDialogs = document.querySelectorAll('#text-dialog');\n\n allDialogs.forEach(function(s) {\n return s.remove();\n });\n };\n\n onDone = () => {\n const { onDone } = this.props;\n const { value } = this.state;\n\n onDone(value);\n this.closeDialog();\n };\n\n render() {\n const { value } = this.state;\n\n return (\n <Dialog open disablePortal onClose={this.closeDialog} id=\"text-dialog\" hideBackdrop>\n <DialogContent>\n <div style={{ display: 'flex' }}>\n <ArrowBackIos style={{ paddingTop: '6px' }} />\n <TextField\n multiline\n placeholder={'Enter an Alt Text description of this image'}\n helperText={\n 'Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.'\n }\n value={value}\n onChange={event => this.setState({ value: event.target.value })}\n />\n </div>\n </DialogContent>\n <DialogActions>\n <Button onClick={this.onDone}>Done</Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n\nexport default AltDialog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,S;;;;;EAMX,mBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACjB,0BAAMA,KAAN;IADiB,gGAUL,YAAM;MAClB,IAAMC,UAAU,GAAGC,QAAQ,CAACC,gBAAT,CAA0B,cAA1B,CAAnB;MAEAF,UAAU,CAACG,OAAX,CAAmB,UAASC,CAAT,EAAY;QAC7B,OAAOA,CAAC,CAACC,MAAF,EAAP;MACD,CAFD;IAGD,CAhBkB;IAAA,2FAkBV,YAAM;MACb,IAAQC,MAAR,GAAmB,MAAKP,KAAxB,CAAQO,MAAR;MACA,IAAQC,KAAR,GAAkB,MAAKC,KAAvB,CAAQD,KAAR;MAEAD,MAAM,CAACC,KAAD,CAAN;;MACA,MAAKE,WAAL;IACD,CAxBkB;IAGjB,IAAQC,GAAR,GAAgBX,KAAhB,CAAQW,GAAR;IAEA,MAAKF,KAAL,GAAa;MACXD,KAAK,EAAEG;IADI,CAAb;IALiB;EAQlB;;;;WAkBD,kBAAS;MAAA;;MACP,IAAQH,KAAR,GAAkB,KAAKC,KAAvB,CAAQD,KAAR;MAEA,oBACE,gCAAC,kBAAD;QAAQ,IAAI,MAAZ;QAAa,aAAa,MAA1B;QAA2B,OAAO,EAAE,KAAKE,WAAzC;QAAsD,EAAE,EAAC,aAAzD;QAAuE,YAAY;MAAnF,gBACE,gCAAC,yBAAD,qBACE;QAAK,KAAK,EAAE;UAAEE,OAAO,EAAE;QAAX;MAAZ,gBACE,gCAAC,wBAAD;QAAc,KAAK,EAAE;UAAEC,UAAU,EAAE;QAAd;MAArB,EADF,eAEE,gCAAC,qBAAD;QACE,SAAS,MADX;QAEE,WAAW,EAAE,6CAFf;QAGE,UAAU,EACR,0HAJJ;QAME,KAAK,EAAEL,KANT;QAOE,QAAQ,EAAE,kBAAAM,KAAK;UAAA,OAAI,MAAI,CAACC,QAAL,CAAc;YAAEP,KAAK,EAAEM,KAAK,CAACE,MAAN,CAAaR;UAAtB,CAAd,CAAJ;QAAA;MAPjB,EAFF,CADF,CADF,eAeE,gCAAC,yBAAD,qBACE,gCAAC,kBAAD;QAAQ,OAAO,EAAE,KAAKD;MAAtB,UADF,CAfF,CADF;IAqBD;;;EAxD4BU,iBAAA,CAAMC,S;;;iCAAxBnB,S,eACQ;EACjBQ,MAAM,EAAEY,qBAAA,CAAUC,IAAV,CAAeC,UADN;EAEjBV,GAAG,EAAEQ,qBAAA,CAAUG;AAFE,C;eA0DNvB,S"}
|
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = exports.Component = void 0;
|
|
7
9
|
|
|
8
|
-
var
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
15
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
17
|
-
|
|
18
|
-
var _styles = require("@material-ui/core/styles");
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearProgress"));
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
var _react = _interopRequireDefault(require("react"));
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
var _styles = require("@material-ui/core/styles");
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
var _slatePropTypes = _interopRequireDefault(require("slate-prop-types"));
|
|
41
39
|
|
|
42
|
-
function
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
41
|
|
|
44
|
-
function
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
43
|
|
|
46
44
|
var log = (0, _debug["default"])('@pie-lib:editable-html:plugins:image:component');
|
|
47
45
|
|
|
@@ -49,56 +47,42 @@ var size = function size(s) {
|
|
|
49
47
|
return s ? "".concat(s, "px") : 'auto';
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
var Component =
|
|
53
|
-
|
|
54
|
-
function (_React$Component) {
|
|
55
|
-
_inherits(Component, _React$Component);
|
|
50
|
+
var Component = /*#__PURE__*/function (_React$Component) {
|
|
51
|
+
(0, _inherits2["default"])(Component, _React$Component);
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
var _getPrototypeOf2;
|
|
53
|
+
var _super = _createSuper(Component);
|
|
59
54
|
|
|
55
|
+
function Component() {
|
|
60
56
|
var _this;
|
|
61
57
|
|
|
62
|
-
|
|
58
|
+
(0, _classCallCheck2["default"])(this, Component);
|
|
63
59
|
|
|
64
60
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
61
|
args[_key] = arguments[_key];
|
|
66
62
|
}
|
|
67
63
|
|
|
68
|
-
_this =
|
|
69
|
-
|
|
70
|
-
_defineProperty(_assertThisInitialized(_this), "getWidth", function (percent) {
|
|
64
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getWidth", function (percent) {
|
|
71
66
|
var multiplier = percent / 100;
|
|
72
67
|
return _this.img.naturalWidth * multiplier;
|
|
73
68
|
});
|
|
74
|
-
|
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "getHeight", function (percent) {
|
|
69
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getHeight", function (percent) {
|
|
76
70
|
var multiplier = percent / 100;
|
|
77
71
|
return _this.img.naturalHeight * multiplier;
|
|
78
72
|
});
|
|
79
|
-
|
|
80
|
-
_defineProperty(_assertThisInitialized(_this), "getPercentFromWidth", function (width) {
|
|
73
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPercentFromWidth", function (width) {
|
|
81
74
|
var floored = width / _this.img.naturalWidth * 4;
|
|
82
75
|
return parseInt(floored.toFixed(0) * 25, 10);
|
|
83
76
|
});
|
|
84
|
-
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "applySizeData", function () {
|
|
77
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "applySizeData", function () {
|
|
86
78
|
var _this$props = _this.props,
|
|
87
79
|
node = _this$props.node,
|
|
88
80
|
editor = _this$props.editor;
|
|
89
|
-
var resizePercent = node.data.get('resizePercent');
|
|
90
|
-
log('[applySizeData]: resizePercent: ', resizePercent);
|
|
91
81
|
var update = node.data;
|
|
82
|
+
var w = update.get('width');
|
|
92
83
|
|
|
93
|
-
if (
|
|
94
|
-
update = update.set('
|
|
95
|
-
update = update.set('height', _this.getHeight(resizePercent));
|
|
96
|
-
} else {
|
|
97
|
-
var w = update.get('width');
|
|
98
|
-
|
|
99
|
-
if (w) {
|
|
100
|
-
update = update.set('resizePercent', _this.getPercentFromWidth(w));
|
|
101
|
-
}
|
|
84
|
+
if (w) {
|
|
85
|
+
update = update.set('resizePercent', _this.getPercentFromWidth(w));
|
|
102
86
|
}
|
|
103
87
|
|
|
104
88
|
log('[applySizeData] update: ', update);
|
|
@@ -111,14 +95,145 @@ function (_React$Component) {
|
|
|
111
95
|
});
|
|
112
96
|
}
|
|
113
97
|
});
|
|
98
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "initialiseResize", function () {
|
|
99
|
+
window.addEventListener('mousemove', _this.startResizing, false);
|
|
100
|
+
window.addEventListener('mouseup', _this.stopResizing, false);
|
|
101
|
+
});
|
|
102
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "loadImage", function () {
|
|
103
|
+
var _ref = _this.props || {},
|
|
104
|
+
maxImageWidth = _ref.maxImageWidth,
|
|
105
|
+
maxImageHeight = _ref.maxImageHeight;
|
|
106
|
+
|
|
107
|
+
maxImageWidth = maxImageWidth || 700;
|
|
108
|
+
maxImageHeight = maxImageHeight || 900;
|
|
109
|
+
var box = _this.img; //on first load
|
|
110
|
+
|
|
111
|
+
if (!box.style.width || box.style.width === 'auto') {
|
|
112
|
+
var dimensions = {
|
|
113
|
+
width: box && box.naturalWidth || 100,
|
|
114
|
+
height: box && box.naturalHeight || 100
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
var _this$updateImageDime = _this.updateImageDimensions(dimensions, {
|
|
118
|
+
width: dimensions.width < maxImageWidth ? dimensions.width : maxImageWidth,
|
|
119
|
+
height: dimensions.height < maxImageHeight ? dimensions.height : maxImageHeight
|
|
120
|
+
}, true),
|
|
121
|
+
width = _this$updateImageDime.width,
|
|
122
|
+
height = _this$updateImageDime.height;
|
|
123
|
+
|
|
124
|
+
box.style.width = "".concat(width, "px");
|
|
125
|
+
box.style.height = "".concat(height, "px");
|
|
126
|
+
|
|
127
|
+
_this.setState({
|
|
128
|
+
dimensions: {
|
|
129
|
+
height: height,
|
|
130
|
+
width: width
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
var _this$props2 = _this.props,
|
|
135
|
+
node = _this$props2.node,
|
|
136
|
+
editor = _this$props2.editor;
|
|
137
|
+
var update = node.data;
|
|
138
|
+
update = update.set('width', width);
|
|
139
|
+
update = update.set('height', height);
|
|
140
|
+
|
|
141
|
+
if (!update.equals(node.data)) {
|
|
142
|
+
editor.change(function (c) {
|
|
143
|
+
return c.setNodeByKey(node.key, {
|
|
144
|
+
data: update
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "startResizing", function (e) {
|
|
151
|
+
var bounds = e.target.getBoundingClientRect();
|
|
152
|
+
var box = _this.img;
|
|
153
|
+
var dimensions = {
|
|
154
|
+
width: box && box.naturalWidth || 100,
|
|
155
|
+
height: box && box.naturalHeight || 100
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var _this$updateImageDime2 = _this.updateImageDimensions(dimensions, {
|
|
159
|
+
width: e.clientX - bounds.left,
|
|
160
|
+
height: e.clientY - bounds.top
|
|
161
|
+
}, true),
|
|
162
|
+
width = _this$updateImageDime2.width,
|
|
163
|
+
height = _this$updateImageDime2.height;
|
|
164
|
+
|
|
165
|
+
var hasMinimumWidth = width > 50 && height > 50;
|
|
166
|
+
var hasDimensionsConstraints = width <= 700 && height <= 900;
|
|
167
|
+
|
|
168
|
+
if (hasMinimumWidth && hasDimensionsConstraints && box) {
|
|
169
|
+
box.style.width = "".concat(width, "px");
|
|
170
|
+
box.style.height = "".concat(height, "px");
|
|
171
|
+
|
|
172
|
+
_this.setState({
|
|
173
|
+
dimensions: {
|
|
174
|
+
height: height,
|
|
175
|
+
width: width
|
|
176
|
+
}
|
|
177
|
+
});
|
|
114
178
|
|
|
179
|
+
var _this$props3 = _this.props,
|
|
180
|
+
node = _this$props3.node,
|
|
181
|
+
editor = _this$props3.editor;
|
|
182
|
+
var update = node.data;
|
|
183
|
+
update = update.set('width', width);
|
|
184
|
+
update = update.set('height', height);
|
|
185
|
+
|
|
186
|
+
if (!update.equals(node.data)) {
|
|
187
|
+
editor.change(function (c) {
|
|
188
|
+
return c.setNodeByKey(node.key, {
|
|
189
|
+
data: update
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "stopResizing", function () {
|
|
196
|
+
window.removeEventListener('mousemove', _this.startResizing, false);
|
|
197
|
+
window.removeEventListener('mouseup', _this.stopResizing, false);
|
|
198
|
+
});
|
|
199
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateImageDimensions", function (initialDim, nextDim, keepAspectRatio, resizeType) {
|
|
200
|
+
// if we want to keep image aspect ratio
|
|
201
|
+
if (keepAspectRatio) {
|
|
202
|
+
var imageAspectRatio = initialDim.width / initialDim.height;
|
|
203
|
+
|
|
204
|
+
if (resizeType === 'height') {
|
|
205
|
+
// if we want to change image height => we update the width accordingly
|
|
206
|
+
return {
|
|
207
|
+
width: nextDim.height * imageAspectRatio,
|
|
208
|
+
height: nextDim.height
|
|
209
|
+
};
|
|
210
|
+
} // if we want to change image width => we update the height accordingly
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
width: nextDim.width,
|
|
215
|
+
height: nextDim.width / imageAspectRatio
|
|
216
|
+
};
|
|
217
|
+
} // if we don't want to keep aspect ratio, we just update both values
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
width: nextDim.width,
|
|
222
|
+
height: nextDim.height
|
|
223
|
+
};
|
|
224
|
+
});
|
|
115
225
|
return _this;
|
|
116
226
|
}
|
|
117
227
|
|
|
118
|
-
|
|
228
|
+
(0, _createClass2["default"])(Component, [{
|
|
119
229
|
key: "componentDidMount",
|
|
120
230
|
value: function componentDidMount() {
|
|
121
231
|
this.applySizeData();
|
|
232
|
+
var resizeHandle = this.resize;
|
|
233
|
+
|
|
234
|
+
if (resizeHandle) {
|
|
235
|
+
resizeHandle.addEventListener('mousedown', this.initialiseResize, false);
|
|
236
|
+
}
|
|
122
237
|
}
|
|
123
238
|
}, {
|
|
124
239
|
key: "componentDidUpdate",
|
|
@@ -139,51 +254,88 @@ function (_React$Component) {
|
|
|
139
254
|
value: function render() {
|
|
140
255
|
var _this2 = this;
|
|
141
256
|
|
|
142
|
-
var _this$
|
|
143
|
-
node = _this$
|
|
144
|
-
editor = _this$
|
|
145
|
-
classes = _this$
|
|
146
|
-
attributes = _this$
|
|
147
|
-
onFocus = _this$
|
|
257
|
+
var _this$props4 = this.props,
|
|
258
|
+
node = _this$props4.node,
|
|
259
|
+
editor = _this$props4.editor,
|
|
260
|
+
classes = _this$props4.classes,
|
|
261
|
+
attributes = _this$props4.attributes,
|
|
262
|
+
onFocus = _this$props4.onFocus;
|
|
148
263
|
var active = editor.value.isFocused && editor.value.selection.hasEdgeIn(node);
|
|
149
264
|
var src = node.data.get('src');
|
|
150
|
-
var percent = node.data.get('percent');
|
|
151
265
|
var loaded = node.data.get('loaded') !== false;
|
|
152
266
|
var deleteStatus = node.data.get('deleteStatus');
|
|
267
|
+
var alignment = node.data.get('alignment');
|
|
268
|
+
var percent = node.data.get('percent');
|
|
269
|
+
var alt = node.data.get('alt');
|
|
270
|
+
var margin;
|
|
271
|
+
var justifyContent;
|
|
272
|
+
|
|
273
|
+
switch (alignment) {
|
|
274
|
+
case 'left':
|
|
275
|
+
justifyContent = 'flex-start';
|
|
276
|
+
margin = '0';
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case 'center':
|
|
280
|
+
justifyContent = 'center';
|
|
281
|
+
margin = '0 auto';
|
|
282
|
+
break;
|
|
283
|
+
|
|
284
|
+
case 'right':
|
|
285
|
+
justifyContent = 'flex-end';
|
|
286
|
+
margin = 'auto 0 0 auto ';
|
|
287
|
+
break;
|
|
288
|
+
|
|
289
|
+
default:
|
|
290
|
+
justifyContent = 'flex-start';
|
|
291
|
+
margin = '0';
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
153
295
|
log('[render] node.data:', node.data);
|
|
154
296
|
var size = this.getSize(node.data);
|
|
155
297
|
log('[render] style:', size);
|
|
156
|
-
var className = (0, _classnames["default"])(classes.root,
|
|
298
|
+
var className = (0, _classnames["default"])(classes.root, !loaded && classes.loading, deleteStatus === 'pending' && classes.pendingDelete);
|
|
157
299
|
var progressClasses = (0, _classnames["default"])(classes.progress, loaded && classes.hideProgress);
|
|
158
|
-
return [_react["default"].createElement("span", {
|
|
300
|
+
return [/*#__PURE__*/_react["default"].createElement("span", {
|
|
159
301
|
key: 'sp1'
|
|
160
|
-
}, "\xA0"), _react["default"].createElement("div", {
|
|
302
|
+
}, "\xA0"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
161
303
|
key: 'comp',
|
|
162
304
|
onFocus: onFocus,
|
|
163
|
-
className: className
|
|
164
|
-
|
|
305
|
+
className: className,
|
|
306
|
+
style: {
|
|
307
|
+
justifyContent: justifyContent
|
|
308
|
+
}
|
|
309
|
+
}, /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
|
|
165
310
|
mode: "determinate",
|
|
166
311
|
value: percent > 0 ? percent : 0,
|
|
167
312
|
className: progressClasses
|
|
168
|
-
}), _react["default"].createElement("
|
|
169
|
-
|
|
170
|
-
}, attributes, {
|
|
171
|
-
|
|
172
|
-
|
|
313
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
314
|
+
className: classes.imageContainer
|
|
315
|
+
}, /*#__PURE__*/_react["default"].createElement("img", (0, _extends2["default"])({}, attributes, {
|
|
316
|
+
className: (0, _classnames["default"])(classes.image, active && classes.active),
|
|
317
|
+
ref: function ref(_ref2) {
|
|
318
|
+
_this2.img = _ref2;
|
|
319
|
+
},
|
|
320
|
+
src: src,
|
|
321
|
+
style: size,
|
|
322
|
+
onLoad: this.loadImage,
|
|
323
|
+
alt: alt
|
|
324
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
325
|
+
ref: function ref(_ref3) {
|
|
326
|
+
_this2.resize = _ref3;
|
|
173
327
|
},
|
|
174
|
-
|
|
175
|
-
}))), _react["default"].createElement("span", {
|
|
328
|
+
className: (0, _classnames["default"])(classes.resize, 'resize')
|
|
329
|
+
}))), /*#__PURE__*/_react["default"].createElement("span", {
|
|
176
330
|
key: 'sp2'
|
|
177
331
|
}, "\xA0")];
|
|
178
332
|
}
|
|
179
333
|
}]);
|
|
180
|
-
|
|
181
334
|
return Component;
|
|
182
335
|
}(_react["default"].Component);
|
|
183
336
|
|
|
184
337
|
exports.Component = Component;
|
|
185
|
-
|
|
186
|
-
_defineProperty(Component, "propTypes", {
|
|
338
|
+
(0, _defineProperty2["default"])(Component, "propTypes", {
|
|
187
339
|
node: _slatePropTypes["default"].node.isRequired,
|
|
188
340
|
editor: _propTypes["default"].shape({
|
|
189
341
|
change: _propTypes["default"].func.isRequired,
|
|
@@ -192,7 +344,9 @@ _defineProperty(Component, "propTypes", {
|
|
|
192
344
|
classes: _propTypes["default"].object.isRequired,
|
|
193
345
|
attributes: _propTypes["default"].object,
|
|
194
346
|
onFocus: _propTypes["default"].func,
|
|
195
|
-
onBlur: _propTypes["default"].func
|
|
347
|
+
onBlur: _propTypes["default"].func,
|
|
348
|
+
maxImageWidth: _propTypes["default"].number,
|
|
349
|
+
maxImageHeight: _propTypes["default"].number
|
|
196
350
|
});
|
|
197
351
|
|
|
198
352
|
var styles = function styles(theme) {
|
|
@@ -213,7 +367,7 @@ var styles = function styles(theme) {
|
|
|
213
367
|
progress: {
|
|
214
368
|
position: 'absolute',
|
|
215
369
|
left: '0',
|
|
216
|
-
width: '
|
|
370
|
+
width: 'fit-content',
|
|
217
371
|
top: '0%',
|
|
218
372
|
transition: 'opacity 200ms linear'
|
|
219
373
|
},
|
|
@@ -229,15 +383,37 @@ var styles = function styles(theme) {
|
|
|
229
383
|
root: {
|
|
230
384
|
position: 'relative',
|
|
231
385
|
border: 'solid 1px white',
|
|
232
|
-
display: '
|
|
386
|
+
display: 'flex',
|
|
233
387
|
transition: 'opacity 200ms linear'
|
|
234
388
|
},
|
|
235
|
-
active: {
|
|
236
|
-
border: "solid 1px ".concat(theme.palette.primary.main)
|
|
237
|
-
},
|
|
238
389
|
"delete": {
|
|
239
390
|
position: 'absolute',
|
|
240
391
|
right: 0
|
|
392
|
+
},
|
|
393
|
+
imageContainer: {
|
|
394
|
+
position: 'relative',
|
|
395
|
+
width: 'fit-content',
|
|
396
|
+
display: 'flex',
|
|
397
|
+
alignItems: 'center',
|
|
398
|
+
'&&:hover > .resize': {
|
|
399
|
+
display: 'block'
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
active: {
|
|
403
|
+
border: "solid 1px ".concat(theme.palette.primary.main)
|
|
404
|
+
},
|
|
405
|
+
resize: {
|
|
406
|
+
backgroundColor: theme.palette.primary.main,
|
|
407
|
+
cursor: 'col-resize',
|
|
408
|
+
height: '35px',
|
|
409
|
+
width: '5px',
|
|
410
|
+
borderRadius: 8,
|
|
411
|
+
marginLeft: '5px',
|
|
412
|
+
marginRight: '10px',
|
|
413
|
+
display: 'none'
|
|
414
|
+
},
|
|
415
|
+
drawableHeight: {
|
|
416
|
+
minHeight: 350
|
|
241
417
|
}
|
|
242
418
|
};
|
|
243
419
|
};
|