Changeset 2181106
- Timestamp:
- 10/27/2019 08:53:13 PM (6 years ago)
- Location:
- slide/trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
slide/trunk
-
Property
svn:ignore
set to
.cache
.git
.gitignore
.svnignore
node_modules
package-lock.json
package.json
src
-
Property
svn:ignore
set to
-
slide/trunk/index.js
r2180951 r2181106 1 window.slide = {}; 2 window.slide.FontPicker = (({ 3 i18n: { __ }, 4 element: { createElement: e }, 5 components: { BaseControl }, 6 compose: { withInstanceId } 7 }) => { 8 const googleFonts = { 9 'Abril Fatface': { weight: ['400'] }, 10 Anton: { weight: ['400'] }, 11 Arvo: { weight: ['400', '700'] }, 12 Asap: { weight: ['400', '500', '600', '700'] }, 13 'Barlow Condensed': { weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }, 14 Barlow: { weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }, 15 'Cormorant Garamond': { weight: ['300', '400', '500', '600', '700'] }, 16 Faustina: { weight: ['400', '500', '600', '700'] }, 17 'Fira Sans': { weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }, 18 'IBM Plex Sans': { weight: ['100', '200', '300', '400', '500', '600', '700'] }, 19 Inconsolata: { weight: ['400', '700'] }, 20 Heebo: { weight: ['100', '300', '400', '500', '700', '800', '900'] }, 21 Karla: { weight: ['400', '700'] }, 22 Lato: { weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }, 23 Lora: { weight: ['400', '700'] }, 24 Merriweather: { weight: ['300', '400', '500', '600', '700', '800', '900'] }, 25 Montserrat: { weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] }, 26 'Noto Sans': { weight: ['400', '700'] }, 27 'Noto Serif': { weight: ['400', '700'] }, 28 'Open Sans': { weight: ['300', '400', '500', '600', '700', '800'] }, 29 Oswald: { weight: ['200', '300', '400', '500', '600', '700'] }, 30 'Playfair Display': { weight: ['400', '700', '900'] }, 31 'PT Serif': { weight: ['400', '700'] }, 32 Roboto: { weight: ['100', '300', '400', '500', '700', '900'] }, 33 Rubik: { weight: ['300', '400', '500', '700', '900'] }, 34 Tajawal: { weight: ['200', '300', '400', '500', '700', '800', '900'] }, 35 Ubuntu: { weight: ['300', '400', '500', '700'] }, 36 Yrsa: { weight: ['300', '400', '500', '600', '700'] }, 37 'Source Serif Pro': { weight: ['200', '300', '400', '600', '700', '900'] }, 38 'Source Sans Pro': { weight: ['200', '300', '400', '600', '700', '900'] }, 39 Martel: { weight: ['200', '300', '400', '600', '700', '800', '900'] } 1 // modules are defined as an array 2 // [ module function, map of requires ] 3 // 4 // map of requires is short require name -> numeric require 5 // 6 // anything defined in a previous bundle is accessed via the 7 // orig method which is the require for previous bundles 8 parcelRequire = (function (modules, cache, entry, globalName) { 9 // Save the require from previous bundle to this closure if any 10 var previousRequire = typeof parcelRequire === 'function' && parcelRequire; 11 var nodeRequire = typeof require === 'function' && require; 12 13 function newRequire(name, jumped) { 14 if (!cache[name]) { 15 if (!modules[name]) { 16 // if we cannot find the module within our internal map or 17 // cache jump to the current global require ie. the last bundle 18 // that was added to the page. 19 var currentRequire = typeof parcelRequire === 'function' && parcelRequire; 20 if (!jumped && currentRequire) { 21 return currentRequire(name, true); 22 } 23 24 // If there are other bundles on this page the require from the 25 // previous one is saved to 'previousRequire'. Repeat this as 26 // many times as there are bundles until the module is found or 27 // we exhaust the require chain. 28 if (previousRequire) { 29 return previousRequire(name, true); 30 } 31 32 // Try the node require function if it exists. 33 if (nodeRequire && typeof name === 'string') { 34 return nodeRequire(name); 35 } 36 37 var err = new Error('Cannot find module \'' + name + '\''); 38 err.code = 'MODULE_NOT_FOUND'; 39 throw err; 40 } 41 42 localRequire.resolve = resolve; 43 localRequire.cache = {}; 44 45 var module = cache[name] = new newRequire.Module(name); 46 47 modules[name][0].call(module.exports, localRequire, module, module.exports, this); 48 } 49 50 return cache[name].exports; 51 52 function localRequire(x){ 53 return newRequire(localRequire.resolve(x)); 54 } 55 56 function resolve(x){ 57 return modules[name][1][x] || x; 58 } 59 } 60 61 function Module(moduleName) { 62 this.id = moduleName; 63 this.bundle = newRequire; 64 this.exports = {}; 65 } 66 67 newRequire.isParcelRequire = true; 68 newRequire.Module = Module; 69 newRequire.modules = modules; 70 newRequire.cache = cache; 71 newRequire.parent = previousRequire; 72 newRequire.register = function (id, exports) { 73 modules[id] = [function (require, module) { 74 module.exports = exports; 75 }, {}]; 40 76 }; 41 77 42 return withInstanceId(({ label, value, help, instanceId, onChange, className, ...props }) => { 43 const id = `inspector-coblocks-font-family-${instanceId}`; 44 const systemFonts = [ 45 { value: 'Arial', label: 'Arial' }, 46 { value: '', label: 'Helvetica' }, 47 { value: 'Times New Roman', label: 'Times New Roman' }, 48 { value: 'Georgia', label: 'Georgia' } 49 ]; 50 const fonts = []; 51 52 function sortThings (a, b) { 53 return a > b ? 1 : b > a ? -1 : 0; 78 var error; 79 for (var i = 0; i < entry.length; i++) { 80 try { 81 newRequire(entry[i]); 82 } catch (e) { 83 // Save first error but execute all entries 84 if (!error) { 85 error = e; 86 } 54 87 } 55 56 // Add Google Fonts 57 Object.keys(googleFonts).sort(sortThings).map((k) => { 58 fonts.push( 59 { value: k, label: k } 60 ); 88 } 89 90 if (entry.length) { 91 // Expose entry point to Node, AMD or browser globals 92 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js 93 var mainExports = newRequire(entry[entry.length - 1]); 94 95 // CommonJS 96 if (typeof exports === "object" && typeof module !== "undefined") { 97 module.exports = mainExports; 98 99 // RequireJS 100 } else if (typeof define === "function" && define.amd) { 101 define(function () { 102 return mainExports; 103 }); 104 105 // <script> 106 } else if (globalName) { 107 this[globalName] = mainExports; 108 } 109 } 110 111 // Override the current require with this new one 112 parcelRequire = newRequire; 113 114 if (error) { 115 // throw error from earlier, _after updating parcelRequire_ 116 throw error; 117 } 118 119 return newRequire; 120 })({"eotu":[function(require,module,exports) { 121 "use strict"; 122 123 Object.defineProperty(exports, "__esModule", { 124 value: true 125 }); 126 exports.default = void 0; 127 128 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 129 130 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 131 132 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 133 134 function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } 135 136 function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } 137 138 var _window$wp = window.wp, 139 e = _window$wp.element.createElement, 140 BaseControl = _window$wp.components.BaseControl, 141 withInstanceId = _window$wp.compose.withInstanceId; 142 var googleFonts = { 143 'Abril Fatface': { 144 weight: ['400'] 145 }, 146 Anton: { 147 weight: ['400'] 148 }, 149 Arvo: { 150 weight: ['400', '700'] 151 }, 152 Asap: { 153 weight: ['400', '500', '600', '700'] 154 }, 155 'Barlow Condensed': { 156 weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] 157 }, 158 Barlow: { 159 weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] 160 }, 161 'Cormorant Garamond': { 162 weight: ['300', '400', '500', '600', '700'] 163 }, 164 Faustina: { 165 weight: ['400', '500', '600', '700'] 166 }, 167 'Fira Sans': { 168 weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] 169 }, 170 'IBM Plex Sans': { 171 weight: ['100', '200', '300', '400', '500', '600', '700'] 172 }, 173 Inconsolata: { 174 weight: ['400', '700'] 175 }, 176 Heebo: { 177 weight: ['100', '300', '400', '500', '700', '800', '900'] 178 }, 179 Karla: { 180 weight: ['400', '700'] 181 }, 182 Lato: { 183 weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] 184 }, 185 Lora: { 186 weight: ['400', '700'] 187 }, 188 Merriweather: { 189 weight: ['300', '400', '500', '600', '700', '800', '900'] 190 }, 191 Montserrat: { 192 weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'] 193 }, 194 'Noto Sans': { 195 weight: ['400', '700'] 196 }, 197 'Noto Serif': { 198 weight: ['400', '700'] 199 }, 200 'Open Sans': { 201 weight: ['300', '400', '500', '600', '700', '800'] 202 }, 203 Oswald: { 204 weight: ['200', '300', '400', '500', '600', '700'] 205 }, 206 'Playfair Display': { 207 weight: ['400', '700', '900'] 208 }, 209 'PT Serif': { 210 weight: ['400', '700'] 211 }, 212 Roboto: { 213 weight: ['100', '300', '400', '500', '700', '900'] 214 }, 215 Rubik: { 216 weight: ['300', '400', '500', '700', '900'] 217 }, 218 Tajawal: { 219 weight: ['200', '300', '400', '500', '700', '800', '900'] 220 }, 221 Ubuntu: { 222 weight: ['300', '400', '500', '700'] 223 }, 224 Yrsa: { 225 weight: ['300', '400', '500', '600', '700'] 226 }, 227 'Source Serif Pro': { 228 weight: ['200', '300', '400', '600', '700', '900'] 229 }, 230 'Source Sans Pro': { 231 weight: ['200', '300', '400', '600', '700', '900'] 232 }, 233 Martel: { 234 weight: ['200', '300', '400', '600', '700', '800', '900'] 235 } 236 }; 237 238 var _default = withInstanceId(function (_ref) { 239 var label = _ref.label, 240 value = _ref.value, 241 help = _ref.help, 242 instanceId = _ref.instanceId, 243 onChange = _ref.onChange, 244 className = _ref.className, 245 props = _objectWithoutProperties(_ref, ["label", "value", "help", "instanceId", "onChange", "className"]); 246 247 var id = "inspector-coblocks-font-family-".concat(instanceId); 248 var systemFonts = [{ 249 value: 'Arial', 250 label: 'Arial' 251 }, { 252 value: '', 253 label: 'Helvetica' 254 }, { 255 value: 'Times New Roman', 256 label: 'Times New Roman' 257 }, { 258 value: 'Georgia', 259 label: 'Georgia' 260 }]; 261 var fonts = []; 262 263 function sortThings(a, b) { 264 return a > b ? 1 : b > a ? -1 : 0; 265 } // Add Google Fonts 266 267 268 Object.keys(googleFonts).sort(sortThings).map(function (k) { 269 fonts.push({ 270 value: k, 271 label: k 61 272 }); 62 63 const customFonts = []; 64 65 if (document.fonts && document.fonts.forEach) { 66 document.fonts.forEach((font) => { 67 if (googleFonts[font.family]) { 273 }); 274 var customFonts = []; 275 276 if (document.fonts && document.fonts.forEach) { 277 document.fonts.forEach(function (font) { 278 if (googleFonts[font.family]) { 279 return; 280 } 281 282 if (font.family === 'dashicons') { 283 return; 284 } 285 286 if (customFonts.find(function (_ref2) { 287 var value = _ref2.value; 288 return value === font.family; 289 })) { 290 return; 291 } 292 293 customFonts.push({ 294 value: font.family, 295 label: font.family 296 }); 297 }); 298 } 299 300 var onChangeValue = function onChangeValue(_ref3) { 301 var value = _ref3.target.value; 302 var googleFontsAttr = ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic'; 303 var isSystemFont = systemFonts.filter(function (font) { 304 return font.label === value; 305 }).length > 0; 306 var url = ''; 307 308 if (!isSystemFont) { 309 url = 'https://fonts.googleapis.com/css?family=' + value.replace(/ /g, '+') + googleFontsAttr; 310 } 311 312 onChange(value, url); 313 }; 314 315 return e(BaseControl, { 316 label: label, 317 id: id, 318 help: help, 319 className: className 320 }, e('select', _objectSpread({ 321 className: 'components-select-control__input components-select-control__input--coblocks-fontfamily', 322 onChange: onChangeValue, 323 'aria-describedby': help ? "".concat(id, "__help") : undefined 324 }, props), customFonts.length > 0 && e('optgroup', { 325 label: 'Custom Loaded Fonts' 326 }, customFonts.map(function (option, index) { 327 return e('option', { 328 key: option.value, 329 value: option.value, 330 selected: value === option.value 331 }, option.label); 332 })), e('optgroup', { 333 label: 'System Fonts' 334 }, systemFonts.map(function (option, index) { 335 return e('option', { 336 key: option.value, 337 value: option.value, 338 selected: value === option.value 339 }, option.label); 340 })), e('optgroup', { 341 label: 'Google Fonts' 342 }, fonts.map(function (option, index) { 343 return e('option', { 344 key: option.value, 345 value: option.value, 346 selected: value === option.value 347 }, option.label); 348 })))); 349 }); 350 351 exports.default = _default; 352 },{}],"aPnW":[function(require,module,exports) { 353 "use strict"; 354 355 Object.defineProperty(exports, "__esModule", { 356 value: true 357 }); 358 exports.default = FontWeightPicker; 359 360 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 361 362 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 363 364 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 365 366 function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } 367 368 function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } 369 370 var _window$wp = window.wp, 371 __ = _window$wp.i18n.__, 372 e = _window$wp.element.createElement, 373 SelectControl = _window$wp.components.SelectControl; 374 375 function FontWeightPicker(_ref) { 376 var fontFamily = _ref.fontFamily, 377 props = _objectWithoutProperties(_ref, ["fontFamily"]); 378 379 var options = [{ 380 value: '100', 381 label: __('Thin', 'slide') 382 }, { 383 value: '200', 384 label: __('Extra Light', 'slide') 385 }, { 386 value: '300', 387 label: __('Light', 'slide') 388 }, { 389 value: '400', 390 label: __('Normal', 'slide') 391 }, { 392 value: '500', 393 label: __('Medium', 'slide') 394 }, { 395 value: '600', 396 label: __('Semi Bold', 'slide') 397 }, { 398 value: '700', 399 label: __('Bold', 'slide') 400 }, { 401 value: '800', 402 label: __('Extra Bold', 'slide') 403 }, { 404 value: '900', 405 label: __('Black', 'slide') 406 }]; 407 var weights = new Set(); 408 409 if (document.fonts && document.fonts.forEach) { 410 document.fonts.forEach(function (font) { 411 if (font.family !== fontFamily) { 412 return; 413 } 414 415 weights.add(font.weight); 416 }); 417 } 418 419 if (weights.size) { 420 options.forEach(function (option) { 421 if (weights.has(option.value)) { 422 return; 423 } 424 425 option.disabled = true; 426 }); 427 } 428 429 return e(SelectControl, _objectSpread({}, props, { 430 options: options 431 })); 432 } 433 },{}],"HZbO":[function(require,module,exports) { 434 "use strict"; 435 436 var _fontPicker = _interopRequireDefault(require("./font-picker")); 437 438 var _fontWeightPicker = _interopRequireDefault(require("./font-weight-picker")); 439 440 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 441 442 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 443 444 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 445 446 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 447 448 var _window$wp = window.wp, 449 addFilter = _window$wp.hooks.addFilter, 450 _window$wp$element = _window$wp.element, 451 e = _window$wp$element.createElement, 452 f = _window$wp$element.Fragment, 453 InspectorControls = _window$wp.blockEditor.InspectorControls, 454 PanelBody = _window$wp.components.PanelBody, 455 __ = _window$wp.i18n.__; 456 var allowedBlocks = new Set(['core/paragraph']); 457 addFilter('blocks.registerBlockType', 'slide/register-block-attributes', function (settings) { 458 if (!allowedBlocks.has(settings.name)) { 459 return settings; 460 } 461 462 return _objectSpread({}, settings, { 463 attributes: _objectSpread({}, settings.attributes, { 464 fontFamily: { 465 type: 'string' 466 }, 467 fontWeight: { 468 type: 'string' 469 } 470 }) 471 }); 472 }); 473 addFilter('editor.BlockEdit', 'slide/control-block-attributes', function (BlockEdit) { 474 return function (props) { 475 var attributes = props.attributes, 476 setAttributes = props.setAttributes, 477 isSelected = props.isSelected, 478 name = props.name; 479 return e(f, null, e(BlockEdit, props), isSelected && allowedBlocks.has(name) && e(InspectorControls, null, e(PanelBody, { 480 title: __('Font', 'slide'), 481 icon: 'format-text', 482 initialOpen: false 483 }, e(_fontPicker.default, { 484 label: __('Font Family', 'slide'), 485 value: attributes.fontFamily, 486 onChange: function onChange(fontFamily) { 487 return setAttributes({ 488 fontFamily: fontFamily 489 }); 490 } 491 }), e(_fontWeightPicker.default, { 492 label: __('Font Weight', 'slide'), 493 value: attributes.fontWeight || '400', 494 onChange: function onChange(fontWeight) { 495 return setAttributes({ 496 fontWeight: fontWeight 497 }); 498 }, 499 fontFamily: attributes.fontFamily 500 })))); 501 }; 502 }); 503 addFilter('editor.BlockListBlock', 'slide/edit-block-attributes', function (BlockListBlock) { 504 return function (props) { 505 if (allowedBlocks.has(props.block.name)) { 506 var _props = props, 507 _props$wrapperProps = _props.wrapperProps, 508 wrapperProps = _props$wrapperProps === void 0 ? {} : _props$wrapperProps, 509 attributes = _props.attributes; 510 var _wrapperProps$style = wrapperProps.style, 511 style = _wrapperProps$style === void 0 ? {} : _wrapperProps$style; 512 var fontFamily = attributes.fontFamily, 513 fontWeight = attributes.fontWeight; 514 515 if (fontFamily) { 516 props = _objectSpread({}, props, { 517 wrapperProps: _objectSpread({}, wrapperProps, { 518 style: _objectSpread({}, style, { 519 fontFamily: fontFamily, 520 fontWeight: fontWeight 521 }) 522 }) 523 }); 524 } 525 } 526 527 return e(BlockListBlock, props); 528 }; 529 }); 530 addFilter('blocks.getSaveContent.extraProps', 'slide/save-block-attributes', function (extraProps, blockType, attributes) { 531 if (!allowedBlocks.has(blockType.name)) { 532 return extraProps; 533 } 534 535 var fontFamily = attributes.fontFamily, 536 fontWeight = attributes.fontWeight; 537 var _extraProps$style = extraProps.style, 538 style = _extraProps$style === void 0 ? {} : _extraProps$style; 539 return _objectSpread({}, extraProps, { 540 style: _objectSpread({}, style, { 541 fontFamily: fontFamily, 542 fontWeight: fontWeight 543 }) 544 }); 545 }); 546 },{"./font-picker":"eotu","./font-weight-picker":"aPnW"}],"Xy8f":[function(require,module,exports) { 547 window.addEventListener('DOMContentLoaded', resize); 548 549 function resize() { 550 var element = document.querySelector('.block-editor-writing-flow'); 551 552 if (!element) { 553 window.requestAnimationFrame(resize); 554 return; 555 } 556 557 var width = element.clientWidth; 558 var parentWidth = element.parentNode.clientWidth; 559 var margin = parentWidth / 26; 560 var innerParentWidth = element.parentNode.clientWidth - margin * 2; 561 var scale = Math.min(1, innerParentWidth / width); 562 var marginLeft = scale === 1 ? (innerParentWidth - width) / 2 + margin : margin; 563 var transform = "translate(".concat(marginLeft, "px, ").concat(margin, "px) scale(").concat(scale, ")"); 564 565 if (element.style.transform !== transform) { 566 element.style.transformOrigin = '0 0'; 567 element.style.transform = transform; 568 } 569 570 window.requestAnimationFrame(resize); 571 } 572 },{}],"XUD5":[function(require,module,exports) { 573 var _window$wp = window.wp, 574 createBlock = _window$wp.blocks.createBlock, 575 _window$wp$data = _window$wp.data, 576 subscribe = _window$wp$data.subscribe, 577 select = _window$wp$data.select, 578 dispatch = _window$wp$data.dispatch; 579 subscribe(function () { 580 var blocks = select('core/block-editor').getBlocks(); 581 var block = blocks.find(function (_ref) { 582 var name = _ref.name; 583 return name !== 'slide/slide'; 584 }); 585 586 if (!block) { 587 return; 588 } 589 590 var slide = createBlock('slide/slide', {}, [block.name === 'core/paragraph' ? createBlock('core/heading') : createBlock(block.name, block.attributes)]); 591 dispatch('core/block-editor').replaceBlock(block.clientId, slide); 592 }); 593 },{}],"S1sO":[function(require,module,exports) { 594 var _window$wp = window.wp, 595 __ = _window$wp.i18n.__, 596 e = _window$wp.element.createElement, 597 _window$wp$richText = _window$wp.richText, 598 registerFormatType = _window$wp$richText.registerFormatType, 599 toggleFormat = _window$wp$richText.toggleFormat, 600 RichTextToolbarButton = _window$wp.blockEditor.RichTextToolbarButton; 601 registerFormatType('slide/fragment', { 602 title: __('Slide Fragment', 'slide'), 603 tagName: 'span', 604 className: 'fragment', 605 edit: function edit(_ref) { 606 var value = _ref.value, 607 onChange = _ref.onChange; 608 return e(RichTextToolbarButton, { 609 icon: 'editor-textcolor', 610 title: __('Slide Fragment', 'slide'), 611 onClick: function onClick() { 612 onChange(toggleFormat(value, { 613 type: 'slide/fragment' 614 })); 615 } 616 }); 617 } 618 }); 619 },{}],"W9ez":[function(require,module,exports) { 620 var _window$wp = window.wp, 621 __ = _window$wp.i18n.__, 622 registerBlockType = _window$wp.blocks.registerBlockType, 623 _window$wp$element = _window$wp.element, 624 e = _window$wp$element.createElement, 625 Fragment = _window$wp$element.Fragment, 626 useSelect = _window$wp.data.useSelect, 627 _window$wp$components = _window$wp.components, 628 TextareaControl = _window$wp$components.TextareaControl, 629 PanelBody = _window$wp$components.PanelBody, 630 RangeControl = _window$wp$components.RangeControl, 631 ToggleControl = _window$wp$components.ToggleControl, 632 Button = _window$wp$components.Button, 633 FocalPointPicker = _window$wp$components.FocalPointPicker, 634 Notice = _window$wp$components.Notice, 635 TextControl = _window$wp$components.TextControl, 636 RadioControl = _window$wp$components.RadioControl, 637 _window$wp$blockEdito = _window$wp.blockEditor, 638 MediaUpload = _window$wp$blockEdito.MediaUpload, 639 InnerBlocks = _window$wp$blockEdito.InnerBlocks, 640 InspectorControls = _window$wp$blockEdito.InspectorControls, 641 ColorPalette = _window$wp$blockEdito.ColorPalette; 642 var ALLOWED_MEDIA_TYPES = ['image']; 643 var backgroundUrlKey = 'presentation-background-url'; 644 registerBlockType('slide/slide', { 645 title: __('Slide', 'slide'), 646 description: __('With this blocks you can form your slide deck! You can override document level setting for each slide block.'), 647 icon: 'slides', 648 category: 'common', 649 keywords: [__('Presentation', 'slide')], 650 attributes: { 651 notes: { 652 type: 'string' 653 }, 654 color: { 655 type: 'string' 656 }, 657 backgroundColor: { 658 type: 'string' 659 }, 660 backgroundId: { 661 type: 'string' 662 }, 663 backgroundUrl: { 664 type: 'string' 665 }, 666 focalPoint: { 667 type: 'object' 668 }, 669 backgroundOpacity: { 670 type: 'string' 671 }, 672 backgroundSize: { 673 type: 'string' 674 }, 675 hidden: { 676 type: 'boolean' 677 }, 678 backgroundIframeUrl: { 679 type: 'string' 680 } 681 }, 682 edit: function edit(_ref) { 683 var attributes = _ref.attributes, 684 setAttributes = _ref.setAttributes, 685 className = _ref.className; 686 var meta = useSelect(function (select) { 687 return select('core/editor').getEditedPostAttribute('meta'); 688 }); 689 return e(Fragment, null, e(InspectorControls, null, e(PanelBody, { 690 title: __('Speaker Notes', 'slide'), 691 icon: 'edit', 692 initialOpen: false 693 }, e(TextareaControl, { 694 label: __('Anything you want to remember.', 'slide'), 695 value: attributes.notes, 696 onChange: function onChange(notes) { 697 return setAttributes({ 698 notes: notes 699 }); 700 }, 701 rows: 10 702 })), e(PanelBody, { 703 title: __('Font', 'slide'), 704 icon: 'text', 705 initialOpen: false 706 }, e(ColorPalette, { 707 label: __('Color', 'slide'), 708 value: attributes.color, 709 onChange: function onChange(color) { 710 return setAttributes({ 711 color: color 712 }); 713 } 714 }), !!attributes.color && e(Button, { 715 isDefault: true, 716 onClick: function onClick() { 717 setAttributes({ 718 color: undefined 719 }); 720 } 721 }, __('Remove'))), e(PanelBody, { 722 title: __('Background Color', 'slide'), 723 icon: 'art', 724 initialOpen: false 725 }, e(ColorPalette, { 726 label: __('Background Color', 'slide'), 727 value: attributes.backgroundColor, 728 onChange: function onChange(backgroundColor) { 729 return setAttributes({ 730 backgroundColor: backgroundColor 731 }); 732 } 733 }), (attributes.backgroundUrl || meta[backgroundUrlKey]) && e(RangeControl, { 734 label: __('Opacity', 'slide'), 735 value: attributes.backgroundOpacity ? 100 - parseInt(attributes.backgroundOpacity, 10) : undefined, 736 min: 0, 737 max: 100, 738 initialPosition: 0, 739 onChange: function onChange(value) { 740 if (value === undefined) { 741 setAttributes({ 742 backgroundOpacity: undefined 743 }); 744 } else { 745 setAttributes({ 746 backgroundOpacity: 100 - value + '' 747 }); 748 } 749 } 750 }), !!attributes.backgroundColor && e(Button, { 751 isDefault: true, 752 onClick: function onClick() { 753 setAttributes({ 754 backgroundColor: undefined 755 }); 756 } 757 }, __('Remove'))), e(PanelBody, { 758 title: __('Background Image', 'slide'), 759 icon: 'format-image', 760 initialOpen: false 761 }, e(MediaUpload, { 762 onSelect: function onSelect(media) { 763 if (!media || !media.url) { 764 setAttributes({ 765 backgroundUrl: undefined, 766 backgroundId: undefined, 767 backgroundSize: undefined, 768 focalPoint: undefined 769 }); 68 770 return; 69 771 } 70 772 71 if (font.family === 'dashicons') { 773 setAttributes({ 774 backgroundUrl: media.url, 775 backgroundId: media.id 776 }); 777 }, 778 allowedTypes: ALLOWED_MEDIA_TYPES, 779 value: attributes.backgroundId, 780 render: function render(_ref2) { 781 var open = _ref2.open; 782 return e(Button, { 783 isDefault: true, 784 onClick: open 785 }, attributes.backgroundUrl ? __('Change') : __('Add Background Image')); 786 } 787 }), ' ', !!attributes.backgroundUrl && e(Button, { 788 isDefault: true, 789 onClick: function onClick() { 790 setAttributes({ 791 backgroundUrl: undefined, 792 backgroundId: undefined, 793 backgroundSize: undefined, 794 focalPoint: undefined 795 }); 796 } 797 }, __('Remove')), e('br'), e('br'), !!attributes.backgroundUrl && e(FocalPointPicker, { 798 label: __('Focal Point Picker'), 799 url: attributes.backgroundUrl, 800 value: attributes.focalPoint, 801 onChange: function onChange(focalPoint) { 802 return setAttributes({ 803 focalPoint: focalPoint 804 }); 805 } 806 }), !!attributes.backgroundUrl && e(RangeControl, { 807 label: __('Opacity', 'slide'), 808 value: attributes.backgroundOpacity ? parseInt(attributes.backgroundOpacity, 10) : undefined, 809 min: 0, 810 max: 100, 811 initialPosition: 100, 812 onChange: function onChange(value) { 813 return setAttributes({ 814 backgroundOpacity: value + '' 815 }); 816 } 817 }), !!attributes.backgroundUrl && e(RadioControl, { 818 label: __('Size', 'slide'), 819 selected: attributes.backgroundSize, 820 options: [{ 821 label: __('Cover'), 822 value: 'cover' 823 }, { 824 label: __('Contain'), 825 value: 'contain' 826 }], 827 onChange: function onChange(backgroundSize) { 828 return setAttributes({ 829 backgroundSize: backgroundSize 830 }); 831 } 832 })), e(PanelBody, { 833 title: __('Background Iframe', 'slide'), 834 icon: 'format-video', 835 initialOpen: false 836 }, e(TextControl, { 837 label: __('Iframe URL'), 838 value: attributes.backgroundIframeUrl, 839 onChange: function onChange(backgroundIframeUrl) { 840 return setAttributes({ 841 backgroundIframeUrl: backgroundIframeUrl 842 }); 843 } 844 }), e('br'), e('br'), !!attributes.backgroundIframeUrl && e(RangeControl, { 845 label: __('Opacity', 'slide'), 846 value: attributes.backgroundOpacity ? parseInt(attributes.backgroundOpacity, 10) : undefined, 847 min: 0, 848 max: 100, 849 initialPosition: 100, 850 onChange: function onChange(value) { 851 return setAttributes({ 852 backgroundOpacity: value + '' 853 }); 854 } 855 })), e(PanelBody, { 856 title: __('Visibility', 'slide'), 857 icon: 'visibility', 858 initialOpen: false 859 }, e(ToggleControl, { 860 label: __('Hide Slide', 'slide'), 861 checked: attributes.hidden, 862 onChange: function onChange(hidden) { 863 return setAttributes({ 864 hidden: hidden 865 }); 866 } 867 }))), attributes.hidden && e(Notice, { 868 status: 'warning', 869 isDismissible: false 870 }, 'This slide is hidden'), e('div', { 871 className: 'wp-block-slide-slide__body', 872 style: { 873 color: attributes.color || undefined, 874 backgroundColor: attributes.backgroundColor || undefined, 875 // If a background color is set, disable the global gradient. 876 backgroundImage: attributes.backgroundColor ? 'none' : undefined 877 } 878 }, e('div', { 879 className: 'wp-block-slide-slide__background', 880 style: { 881 backgroundImage: attributes.backgroundUrl ? "url(\"".concat(attributes.backgroundUrl, "\")") : undefined, 882 backgroundPosition: attributes.focalPoint ? "".concat(attributes.focalPoint.x * 100, "% ").concat(attributes.focalPoint.y * 100, "%") : undefined, 883 backgroundSize: attributes.backgroundSize ? attributes.backgroundSize : undefined, 884 opacity: attributes.backgroundOpacity ? attributes.backgroundOpacity / 100 : undefined 885 } 886 }, !!attributes.backgroundIframeUrl && e('iframe', { 887 src: attributes.backgroundIframeUrl 888 })), e('section', { 889 className: className 890 }, e(InnerBlocks)))); 891 }, 892 save: function save(_ref3) { 893 var attributes = _ref3.attributes; 894 return e(attributes.hidden ? 'div' : 'section', { 895 style: { 896 color: attributes.color || undefined, 897 display: attributes.hidden ? 'none' : undefined 898 }, 899 'data-background-color': attributes.backgroundColor || undefined, 900 'data-background-image': attributes.backgroundUrl ? attributes.backgroundUrl : undefined, 901 'data-background-position': attributes.focalPoint ? "".concat(attributes.focalPoint.x * 100, "% ").concat(attributes.focalPoint.y * 100, "%") : undefined, 902 'data-background-opacity': attributes.backgroundOpacity ? attributes.backgroundOpacity / 100 : undefined, 903 'data-background-iframe': attributes.backgroundIframeUrl ? attributes.backgroundIframeUrl : undefined, 904 'data-background-size': attributes.backgroundSize ? attributes.backgroundSize : undefined 905 }, e(InnerBlocks.Content)); 906 } 907 }); 908 },{}],"wMKM":[function(require,module,exports) { 909 "use strict"; 910 911 Object.defineProperty(exports, "__esModule", { 912 value: true 913 }); 914 exports.default = void 0; 915 916 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 917 918 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 919 920 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 921 922 function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } 923 924 function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } 925 926 var _window$wp = window.wp, 927 _window$wp$element = _window$wp.element, 928 e = _window$wp$element.createElement, 929 useRef = _window$wp$element.useRef, 930 useEffect = _window$wp$element.useEffect, 931 memo = _window$wp$element.memo, 932 _window$wp$codeEditor = _window$wp.codeEditor, 933 initialize = _window$wp$codeEditor.initialize, 934 defaultSettings = _window$wp$codeEditor.defaultSettings; 935 936 var _default = memo(function (_ref) { 937 var onChange = _ref.onChange, 938 props = _objectWithoutProperties(_ref, ["onChange"]); 939 940 var ref = useRef(); 941 useEffect(function () { 942 var editor = initialize(ref.current, _objectSpread({}, defaultSettings, { 943 codemirror: _objectSpread({}, defaultSettings.codemirror, { 944 tabSize: 2, 945 mode: 'css', 946 lineNumbers: false 947 }) 948 })); 949 editor.codemirror.on('change', function () { 950 onChange(editor.codemirror.getValue()); 951 }); 952 return function () { 953 editor.codemirror.toTextArea(); 954 }; 955 }); 956 return e('textarea', _objectSpread({ 957 ref: ref 958 }, props)); // Never rerender. 959 }, function () { 960 return true; 961 }); 962 963 exports.default = _default; 964 },{}],"GOVZ":[function(require,module,exports) { 965 "use strict"; 966 967 var _fontPicker = _interopRequireDefault(require("./font-picker")); 968 969 var _fontWeightPicker = _interopRequireDefault(require("./font-weight-picker")); 970 971 var _codeEditor = _interopRequireDefault(require("./code-editor")); 972 973 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 974 975 function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } 976 977 function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } 978 979 function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 980 981 function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 982 983 function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } 984 985 function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } 986 987 function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } 988 989 function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } 990 991 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } 992 993 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 994 995 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 996 997 var _window$wp = window.wp, 998 __ = _window$wp.i18n.__, 999 e = _window$wp.element.createElement, 1000 registerPlugin = _window$wp.plugins.registerPlugin, 1001 PluginDocumentSettingPanel = _window$wp.editPost.PluginDocumentSettingPanel, 1002 _window$wp$data = _window$wp.data, 1003 useSelect = _window$wp$data.useSelect, 1004 useDispatch = _window$wp$data.useDispatch, 1005 _window$wp$components = _window$wp.components, 1006 TextareaControl = _window$wp$components.TextareaControl, 1007 RangeControl = _window$wp$components.RangeControl, 1008 SelectControl = _window$wp$components.SelectControl, 1009 ToggleControl = _window$wp$components.ToggleControl, 1010 Button = _window$wp$components.Button, 1011 FocalPointPicker = _window$wp$components.FocalPointPicker, 1012 ExternalLink = _window$wp$components.ExternalLink, 1013 TextControl = _window$wp$components.TextControl, 1014 RadioControl = _window$wp$components.RadioControl, 1015 _window$wp$blockEdito = _window$wp.blockEditor, 1016 MediaUpload = _window$wp$blockEdito.MediaUpload, 1017 __experimentalGradientPickerControl = _window$wp$blockEdito.__experimentalGradientPickerControl, 1018 ColorPalette = _window$wp$blockEdito.ColorPalette, 1019 addQueryArgs = _window$wp.url.addQueryArgs; 1020 var colorKey = 'presentation-color'; 1021 var bgColorKey = 'presentation-background-color'; 1022 var backgroundGradientKey = 'presentation-background-gradient'; 1023 var backgroundUrlKey = 'presentation-background-url'; 1024 var backgroundIdKey = 'presentation-background-id'; 1025 var backgroundPositionKey = 'presentation-background-position'; 1026 var backgroundOpacityKey = 'presentation-background-opacity'; 1027 var cssKey = 'presentation-css'; 1028 var fontSizeKey = 'presentation-font-size'; 1029 var fontFamilyKey = 'presentation-font-family'; 1030 var fontFamilyUrlKey = 'presentation-font-family-url'; 1031 var fontFamilyHeadingKey = 'presentation-font-family-heading'; 1032 var fontFamilyHeadingUrlKey = 'presentation-font-family-heading-url'; 1033 var fontWeightHeadingKey = 'presentation-font-weight-heading'; 1034 var transitionKey = 'presentation-transition'; 1035 var backgroundTransitionKey = 'presentation-background-transition'; 1036 var transitionSpeedKey = 'presentation-transition-speed'; 1037 var controlsKey = 'presentation-controls'; 1038 var progressKey = 'presentation-progress'; 1039 var widthKey = 'presentation-width'; 1040 var horizontalPaddingKey = 'presentation-horizontal-padding'; 1041 var verticalPaddingKey = 'presentation-vertical-padding'; 1042 var colorPaletteKey = 'presentation-color-palette'; 1043 var ALLOWED_MEDIA_TYPES = ['image']; 1044 registerPlugin('slide', { 1045 render: function render() { 1046 var meta = useSelect(function (select) { 1047 return select('core/editor').getEditedPostAttribute('meta'); 1048 }); 1049 var link = useSelect(function (select) { 1050 return select('core/editor').getCurrentPost('meta').link; 1051 }); 1052 1053 var _useDispatch = useDispatch('core/editor'), 1054 editPost = _useDispatch.editPost; 1055 1056 var updateMeta = function updateMeta(value, key) { 1057 return editPost({ 1058 meta: _objectSpread({}, meta, _defineProperty({}, key, value)) 1059 }); 1060 }; 1061 1062 var bodyRules = { 1063 'background-color': meta[bgColorKey] || '#fff', 1064 'background-image': meta[backgroundGradientKey] || 'none', 1065 color: meta[colorKey] || '#000', 1066 'font-size': (meta[fontSizeKey] || '42') + 'px', 1067 'font-family': meta[fontFamilyKey] || 'Helvetica, sans-serif' 1068 }; 1069 var rules = { 1070 width: meta[widthKey] ? meta[widthKey] + 'px !important' : undefined, 1071 'padding-top': meta[verticalPaddingKey] ? meta[verticalPaddingKey] : '0.2em', 1072 'padding-bottom': meta[verticalPaddingKey] ? meta[verticalPaddingKey] : '0.2em', 1073 'padding-left': meta[horizontalPaddingKey] ? meta[horizontalPaddingKey] : '0.2em', 1074 'padding-right': meta[horizontalPaddingKey] ? meta[horizontalPaddingKey] : '0.2em' 1075 }; 1076 var backgroundRules = { 1077 'background-image': meta[backgroundUrlKey] ? "url(\"".concat(meta[backgroundUrlKey], "\")") : 'none', 1078 'background-size': 'cover', 1079 'background-position': meta[backgroundPositionKey] ? meta[backgroundPositionKey] : '50% 50%', 1080 opacity: meta[backgroundOpacityKey] ? meta[backgroundOpacityKey] / 100 : 1 1081 }; 1082 return [].concat(_toConsumableArray(Object.keys(bodyRules).map(function (key) { 1083 return e('style', null, ".wp-block-slide-slide__body {".concat(key, ":").concat(bodyRules[key], "}")); 1084 })), _toConsumableArray(Object.keys(rules).map(function (key) { 1085 return e('style', null, ".wp-block-slide-slide {".concat(key, ":").concat(rules[key], "}")); 1086 })), _toConsumableArray(Object.keys(backgroundRules).map(function (key) { 1087 return e('style', null, ".wp-block-slide-slide__background {".concat(key, ":").concat(backgroundRules[key], "}")); 1088 })), [e('style', null, meta[cssKey]), !!meta[fontFamilyUrlKey] && e('style', null, "@import url(\"".concat(meta[fontFamilyUrlKey], "\")")), !!meta[fontFamilyHeadingKey] && e('style', null, (meta[fontFamilyHeadingUrlKey] ? "@import url(\"".concat(meta[fontFamilyHeadingUrlKey], "\");") : '') + ".wp-block-slide-slide h1, .wp-block-slide-slide h2, .wp-block-slide-slide h3, .wp-block-slide-slide h4, .wp-block-slide-slide h5, .wp-block-slide-slide h6 { font-family: ".concat(meta[fontFamilyHeadingKey], " }")), !!meta[fontWeightHeadingKey] && e('style', null, ".wp-block-slide-slide h1, .wp-block-slide-slide h2, .wp-block-slide-slide h3, .wp-block-slide-slide h4, .wp-block-slide-slide h5, .wp-block-slide-slide h6 { font-weight: ".concat(meta[fontWeightHeadingKey], " }")), !!meta[widthKey] && e('style', null, ".editor-styles-wrapper .editor-writing-flow { width: ".concat(parseInt(meta[widthKey], 10) + 130, "px !important; }")), e(PluginDocumentSettingPanel, { 1089 name: 'slide-dimensions', 1090 title: __('Setup', 'slide'), 1091 icon: 'editor-expand' 1092 }, e(RadioControl, { 1093 selected: meta[widthKey] === '1280' ? '16:9' : '', 1094 options: [{ 1095 label: __('Standard 4:3'), 1096 value: '' 1097 }, { 1098 label: __('Widescreen 16:9'), 1099 value: '16:9' 1100 }], 1101 onChange: function onChange(value) { 1102 editPost({ 1103 meta: _defineProperty({}, widthKey, value === '16:9' ? '1280' : '') 1104 }); 1105 } 1106 }), e(TextControl, { 1107 label: __('Horizontal Padding'), 1108 placeholder: '0.2em', 1109 value: meta[horizontalPaddingKey], 1110 onChange: function onChange(value) { 1111 return updateMeta(value, horizontalPaddingKey); 1112 } 1113 }), e(TextControl, { 1114 label: __('Vertical Padding'), 1115 placeholder: '0.2em', 1116 value: meta[verticalPaddingKey], 1117 onChange: function onChange(value) { 1118 return updateMeta(value, verticalPaddingKey); 1119 } 1120 })), e(PluginDocumentSettingPanel, { 1121 name: 'slide-font', 1122 title: __('Base Font', 'slide'), 1123 icon: 'text' 1124 }, e(RangeControl, { 1125 label: __('Font Size', 'slide'), 1126 value: meta[fontSizeKey] ? parseInt(meta[fontSizeKey], 10) : undefined, 1127 min: 10, 1128 max: 100, 1129 initialPosition: 42, 1130 onChange: function onChange(value) { 1131 return updateMeta(value + '', fontSizeKey); 1132 } 1133 }), e(_fontPicker.default, { 1134 label: __('Font Family', 'slide'), 1135 value: meta[fontFamilyKey], 1136 onChange: function onChange(value, fontUrl) { 1137 var _meta2; 1138 1139 editPost({ 1140 meta: (_meta2 = {}, _defineProperty(_meta2, fontFamilyKey, value), _defineProperty(_meta2, fontFamilyUrlKey, fontUrl), _meta2) 1141 }); 1142 } 1143 }), e(ColorPalette, { 1144 label: __('Color', 'slide'), 1145 value: meta[colorKey], 1146 onChange: function onChange(value) { 1147 return updateMeta(value, colorKey); 1148 } 1149 })), e(PluginDocumentSettingPanel, { 1150 name: 'slide-heading-font', 1151 title: __('Heading Font', 'slide'), 1152 icon: 'text' 1153 }, e(_fontPicker.default, { 1154 label: __('Font Family', 'slide'), 1155 value: meta[fontFamilyHeadingKey], 1156 onChange: function onChange(value, fontUrl) { 1157 var _meta3; 1158 1159 editPost({ 1160 meta: (_meta3 = {}, _defineProperty(_meta3, fontFamilyHeadingKey, value), _defineProperty(_meta3, fontFamilyHeadingUrlKey, fontUrl), _meta3) 1161 }); 1162 } 1163 }), e(_fontWeightPicker.default, { 1164 label: __('Font Weight', 'slide'), 1165 value: meta[fontWeightHeadingKey] || '400', 1166 onChange: function onChange(value) { 1167 return updateMeta(value, fontWeightHeadingKey); 1168 }, 1169 fontFamily: meta[fontFamilyHeadingKey] 1170 })), e(PluginDocumentSettingPanel, { 1171 name: 'slide-background', 1172 title: __('Background', 'slide'), 1173 icon: 'art' 1174 }, e(ColorPalette, { 1175 label: __('Background Color', 'slide'), 1176 value: meta[bgColorKey], 1177 onChange: function onChange(value) { 1178 var _objectSpread3; 1179 1180 editPost({ 1181 meta: _objectSpread({}, meta, (_objectSpread3 = {}, _defineProperty(_objectSpread3, bgColorKey, value), _defineProperty(_objectSpread3, backgroundGradientKey, ''), _objectSpread3)) 1182 }); 1183 } 1184 }), __('Experimental:'), __experimentalGradientPickerControl && e(__experimentalGradientPickerControl, { 1185 onChange: function onChange(value) { 1186 return updateMeta(value, backgroundGradientKey); 1187 }, 1188 value: meta[backgroundGradientKey] 1189 }), !!meta[backgroundUrlKey] && e(RangeControl, { 1190 label: __('Opacity', 'slide'), 1191 help: __('May be overridden by the block!'), 1192 value: meta[backgroundOpacityKey] ? 100 - parseInt(meta[backgroundOpacityKey], 10) : undefined, 1193 min: 0, 1194 max: 100, 1195 initialPosition: 0, 1196 onChange: function onChange(value) { 1197 editPost({ 1198 meta: _objectSpread({}, meta, _defineProperty({}, backgroundOpacityKey, 100 - value + '')) 1199 }); 1200 } 1201 })), e(PluginDocumentSettingPanel, { 1202 name: 'slide-background-image', 1203 title: __('Background Image', 'slide'), 1204 icon: 'format-image' 1205 }, e(MediaUpload, { 1206 onSelect: function onSelect(media) { 1207 var _objectSpread6; 1208 1209 if (!media || !media.url) { 1210 var _objectSpread5; 1211 1212 editPost({ 1213 meta: _objectSpread({}, meta, (_objectSpread5 = {}, _defineProperty(_objectSpread5, backgroundUrlKey, undefined), _defineProperty(_objectSpread5, backgroundIdKey, undefined), _defineProperty(_objectSpread5, backgroundPositionKey, undefined), _defineProperty(_objectSpread5, backgroundOpacityKey, undefined), _objectSpread5)) 1214 }); 72 1215 return; 73 1216 } 74 1217 75 if (customFonts.find(({ value }) => value === font.family)) { 1218 editPost({ 1219 meta: _objectSpread({}, meta, (_objectSpread6 = {}, _defineProperty(_objectSpread6, backgroundUrlKey, media.url), _defineProperty(_objectSpread6, backgroundIdKey, media.id + ''), _objectSpread6)) 1220 }); 1221 }, 1222 allowedTypes: ALLOWED_MEDIA_TYPES, 1223 value: meta[backgroundIdKey] ? parseInt(meta[backgroundIdKey], 10) : undefined, 1224 render: function render(_ref) { 1225 var open = _ref.open; 1226 return e(Button, { 1227 isDefault: true, 1228 onClick: open 1229 }, meta[backgroundUrlKey] ? __('Change') : __('Add Background Image')); 1230 } 1231 }), ' ', !!meta[backgroundUrlKey] && e(Button, { 1232 isDefault: true, 1233 onClick: function onClick() { 1234 var _objectSpread7; 1235 1236 editPost({ 1237 meta: _objectSpread({}, meta, (_objectSpread7 = {}, _defineProperty(_objectSpread7, backgroundUrlKey, ''), _defineProperty(_objectSpread7, backgroundIdKey, ''), _defineProperty(_objectSpread7, backgroundPositionKey, ''), _defineProperty(_objectSpread7, backgroundOpacityKey, ''), _objectSpread7)) 1238 }); 1239 } 1240 }, __('Remove')), e('br'), e('br'), !!meta[backgroundUrlKey] && e(FocalPointPicker, { 1241 label: __('Focal Point Picker'), 1242 url: meta[backgroundUrlKey], 1243 value: function () { 1244 if (!meta[backgroundPositionKey]) { 76 1245 return; 77 1246 } 78 1247 79 customFonts.push({ value: font.family, label: font.family }); 80 }); 81 } 82 83 const onChangeValue = ({ target: { value } }) => { 84 const googleFontsAttr = ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic'; 85 const isSystemFont = systemFonts.filter(function (font) { 86 return font.label === value; 87 }).length > 0; 88 89 let url = ''; 90 91 if (!isSystemFont) { 92 url = 'https://fonts.googleapis.com/css?family=' + value.replace(/ /g, '+') + googleFontsAttr; 93 } 94 95 onChange(value, url); 96 }; 97 98 return ( 99 e( 100 BaseControl, 101 { 102 label, 103 id, 104 help, 105 className 106 }, 107 e( 108 'select', 109 { 110 className: 'components-select-control__input components-select-control__input--coblocks-fontfamily', 111 onChange: onChangeValue, 112 'aria-describedby': help ? `${id}__help` : undefined, 113 ...props 114 }, 115 customFonts.length > 0 && e('optgroup', { label: 'Custom Loaded Fonts' }, 116 customFonts.map((option, index) => 117 e('option', { 118 key: option.value, 119 value: option.value, 120 selected: value === option.value 121 }, option.label) 122 ) 123 ), 124 e('optgroup', { label: 'System Fonts' }, 125 systemFonts.map((option, index) => 126 e('option', { 127 key: option.value, 128 value: option.value, 129 selected: value === option.value 130 }, option.label) 131 ) 132 ), 133 e('optgroup', { label: 'Google Fonts' }, 134 fonts.map((option, index) => 135 e('option', { 136 key: option.value, 137 value: option.value, 138 selected: value === option.value 139 }, option.label) 140 ) 141 ) 142 ) 143 ) 144 ); 145 }); 146 })(window.wp); 147 (({ 148 i18n, 149 blocks, 150 element, 151 richText, 152 plugins, 153 editPost, 154 data, 155 components, 156 blockEditor, 157 url, 158 codeEditor 159 }, { FontPicker }) => { 160 const { __ } = i18n; 161 const { registerBlockType, createBlock } = blocks; 162 const { createElement: e, Fragment, useRef, useEffect, memo } = element; 163 const { registerFormatType, toggleFormat } = richText; 164 const { registerPlugin } = plugins; 165 const { PluginDocumentSettingPanel } = editPost; 166 const { useSelect, useDispatch, subscribe, select, dispatch } = data; 167 const { TextareaControl, PanelBody, RangeControl, SelectControl, ToggleControl, Button, FocalPointPicker, ExternalLink, Notice, TextControl, RadioControl } = components; 168 const { MediaUpload, __experimentalGradientPickerControl, InnerBlocks, InspectorControls, RichTextToolbarButton, ColorPalette } = blockEditor; 169 const { addQueryArgs } = url; 170 const colorKey = 'presentation-color'; 171 const bgColorKey = 'presentation-background-color'; 172 const backgroundGradientKey = 'presentation-background-gradient'; 173 const backgroundUrlKey = 'presentation-background-url'; 174 const backgroundIdKey = 'presentation-background-id'; 175 const backgroundPositionKey = 'presentation-background-position'; 176 const backgroundOpacityKey = 'presentation-background-opacity'; 177 const cssKey = 'presentation-css'; 178 const fontSizeKey = 'presentation-font-size'; 179 const fontFamilyKey = 'presentation-font-family'; 180 const fontFamilyUrlKey = 'presentation-font-family-url'; 181 const fontFamilyHeadingKey = 'presentation-font-family-heading'; 182 const fontFamilyHeadingUrlKey = 'presentation-font-family-heading-url'; 183 const fontWeightHeadingKey = 'presentation-font-weight-heading'; 184 const transitionKey = 'presentation-transition'; 185 const backgroundTransitionKey = 'presentation-background-transition'; 186 const transitionSpeedKey = 'presentation-transition-speed'; 187 const controlsKey = 'presentation-controls'; 188 const progressKey = 'presentation-progress'; 189 const widthKey = 'presentation-width'; 190 const horizontalPaddingKey = 'presentation-horizontal-padding'; 191 const verticalPaddingKey = 'presentation-vertical-padding'; 192 const colorPaletteKey = 'presentation-color-palette'; 193 194 const CodeEditor = memo(({ onChange, ...props }) => { 195 const ref = useRef(); 196 197 useEffect(() => { 198 const editor = codeEditor.initialize(ref.current, { 199 ...codeEditor.defaultSettings, 200 codemirror: { 201 ...codeEditor.defaultSettings.codemirror, 202 tabSize: 2, 203 mode: 'css', 204 lineNumbers: false 205 } 206 }); 207 208 editor.codemirror.on('change', () => { 209 onChange(editor.codemirror.getValue()); 210 }); 211 212 return () => { 213 editor.codemirror.toTextArea(); 214 }; 215 }); 216 217 return e('textarea', { 218 ref, 219 ...props 220 }); 221 // Never rerender. 222 }, () => true); 223 224 subscribe(() => { 225 const blocks = select('core/block-editor').getBlocks(); 226 const block = blocks.find(({ name }) => name !== 'slide/slide'); 227 228 if (!block) { 229 return; 230 } 231 232 const slide = createBlock('slide/slide', {}, [ 233 block.name === 'core/paragraph' 234 ? createBlock('core/heading') 235 : createBlock(block.name, block.attributes) 236 ]); 237 238 dispatch('core/block-editor').replaceBlock(block.clientId, slide); 239 }); 240 241 registerPlugin('slide', { 242 render: () => { 243 const meta = useSelect((select) => 244 select('core/editor').getEditedPostAttribute('meta') 245 ); 246 const link = useSelect((select) => 247 select('core/editor').getCurrentPost('meta').link 248 ); 249 const { editPost } = useDispatch('core/editor'); 250 const updateMeta = (value, key) => editPost({ 251 meta: { ...meta, [key]: value } 252 }); 253 254 const bodyRules = { 255 'background-color': meta[bgColorKey] || '#fff', 256 'background-image': meta[backgroundGradientKey] || 'none', 257 color: meta[colorKey] || '#000', 258 'font-size': (meta[fontSizeKey] || '42') + 'px', 259 'font-family': meta[fontFamilyKey] || 'Helvetica, sans-serif' 260 }; 261 262 const rules = { 263 width: meta[widthKey] ? meta[widthKey] + 'px !important' : undefined, 264 'padding-top': meta[verticalPaddingKey] ? meta[verticalPaddingKey] : '0.2em', 265 'padding-bottom': meta[verticalPaddingKey] ? meta[verticalPaddingKey] : '0.2em', 266 'padding-left': meta[horizontalPaddingKey] ? meta[horizontalPaddingKey] : '0.2em', 267 'padding-right': meta[horizontalPaddingKey] ? meta[horizontalPaddingKey] : '0.2em' 268 }; 269 270 const backgroundRules = { 271 'background-image': meta[backgroundUrlKey] ? `url("${meta[backgroundUrlKey]}")` : 'none', 272 'background-size': 'cover', 273 'background-position': meta[backgroundPositionKey] ? meta[backgroundPositionKey] : '50% 50%', 274 opacity: meta[backgroundOpacityKey] ? meta[backgroundOpacityKey] / 100 : 1 275 }; 276 277 return [ 278 ...Object.keys(bodyRules).map((key) => { 279 return e( 280 'style', 281 null, 282 `.wp-block-slide-slide__body {${key}:${bodyRules[key]}}` 283 ); 284 }), 285 ...Object.keys(rules).map((key) => { 286 return e( 287 'style', 288 null, 289 `.wp-block-slide-slide {${key}:${rules[key]}}` 290 ); 291 }), 292 ...Object.keys(backgroundRules).map((key) => { 293 return e( 294 'style', 295 null, 296 `.wp-block-slide-slide__background {${key}:${backgroundRules[key]}}` 297 ); 298 }), 299 e('style', null, meta[cssKey]), 300 !!meta[fontFamilyUrlKey] && e( 301 'style', 302 null, 303 `@import url("${meta[fontFamilyUrlKey]}")` 304 ), 305 !!meta[fontFamilyHeadingKey] && e( 306 'style', 307 null, 308 (meta[fontFamilyHeadingUrlKey] ? `@import url("${meta[fontFamilyHeadingUrlKey]}");` : '') + 309 `.wp-block-slide-slide h1, .wp-block-slide-slide h2, .wp-block-slide-slide h3, .wp-block-slide-slide h4, .wp-block-slide-slide h5, .wp-block-slide-slide h6 { font-family: ${meta[fontFamilyHeadingKey]} }` 310 ), 311 !!meta[fontWeightHeadingKey] && e( 312 'style', 313 null, 314 `.wp-block-slide-slide h1, .wp-block-slide-slide h2, .wp-block-slide-slide h3, .wp-block-slide-slide h4, .wp-block-slide-slide h5, .wp-block-slide-slide h6 { font-weight: ${meta[fontWeightHeadingKey]} }` 315 ), 316 !!meta[widthKey] && e( 317 'style', 318 null, 319 `.editor-styles-wrapper .editor-writing-flow { width: ${parseInt(meta[widthKey], 10) + 130}px !important; }` 320 ), 321 e( 322 PluginDocumentSettingPanel, 323 { 324 name: 'slide-dimensions', 325 title: __('Setup', 'slide'), 326 icon: 'editor-expand' 327 }, 328 e(RadioControl, { 329 selected: meta[widthKey] === '1280' ? '16:9' : '', 330 options: [ 331 { label: __('Standard 4:3'), value: '' }, 332 { label: __('Widescreen 16:9'), value: '16:9' } 333 ], 334 onChange: (value) => { 335 editPost({ 336 meta: { 337 [widthKey]: value === '16:9' ? '1280' : '' 338 } 339 }); 340 } 341 }), 342 e(TextControl, { 343 label: __('Horizontal Padding'), 344 placeholder: '0.2em', 345 value: meta[horizontalPaddingKey], 346 onChange: (value) => updateMeta(value, horizontalPaddingKey) 347 }), 348 e(TextControl, { 349 label: __('Vertical Padding'), 350 placeholder: '0.2em', 351 value: meta[verticalPaddingKey], 352 onChange: (value) => updateMeta(value, verticalPaddingKey) 353 }) 354 ), 355 e( 356 PluginDocumentSettingPanel, 357 { 358 name: 'slide-font', 359 title: __('Base Font', 'slide'), 360 icon: 'text' 361 }, 362 e(RangeControl, { 363 label: __('Font Size', 'slide'), 364 value: meta[fontSizeKey] ? parseInt(meta[fontSizeKey], 10) : undefined, 365 min: 10, 366 max: 100, 367 initialPosition: 42, 368 onChange: (value) => updateMeta(value + '', fontSizeKey) 369 }), 370 e(FontPicker, { 371 label: __('Font Family', 'slide'), 372 value: meta[fontFamilyKey], 373 onChange: (value, fontUrl) => { 374 editPost({ 375 meta: { 376 [fontFamilyKey]: value, 377 [fontFamilyUrlKey]: fontUrl 378 } 379 }); 380 } 381 }), 382 e(ColorPalette, { 383 label: __('Color', 'slide'), 384 value: meta[colorKey], 385 onChange: (value) => updateMeta(value, colorKey) 386 }) 387 ), 388 e( 389 PluginDocumentSettingPanel, 390 { 391 name: 'slide-heading-font', 392 title: __('Heading Font', 'slide'), 393 icon: 'text' 394 }, 395 e(FontPicker, { 396 label: __('Font Family', 'slide'), 397 value: meta[fontFamilyHeadingKey], 398 onChange: (value, fontUrl) => { 399 editPost({ 400 meta: { 401 [fontFamilyHeadingKey]: value, 402 [fontFamilyHeadingUrlKey]: fontUrl 403 } 404 }); 405 } 406 }), 407 e(SelectControl, { 408 label: __('Font Weight', 'slide'), 409 help: __('Depending on the Font, some options may not be available.'), 410 options: [ 411 { value: '100', label: __('Thin', 'slide') }, 412 { value: '200', label: __('Extra Light', 'slide') }, 413 { value: '300', label: __('Light', 'slide') }, 414 { value: '400', label: __('Normal', 'slide') }, 415 { value: '500', label: __('Medium', 'slide') }, 416 { value: '600', label: __('Semi Bold', 'slide') }, 417 { value: '700', label: __('Bold', 'slide') }, 418 { value: '800', label: __('Extra Bold', 'slide') }, 419 { value: '900', label: __('Black', 'slide') } 420 ], 421 value: meta[fontWeightHeadingKey] || '400', 422 onChange: (value) => updateMeta(value, fontWeightHeadingKey) 423 }) 424 ), 425 e( 426 PluginDocumentSettingPanel, 427 { 428 name: 'slide-background', 429 title: __('Background', 'slide'), 430 icon: 'art' 431 }, 432 e(ColorPalette, { 433 label: __('Background Color', 'slide'), 434 value: meta[bgColorKey], 435 onChange: (value) => { 436 editPost({ 437 meta: { 438 ...meta, 439 [bgColorKey]: value, 440 [backgroundGradientKey]: '' 441 } 442 }); 443 } 444 }), 445 __('Experimental:'), 446 __experimentalGradientPickerControl && e(__experimentalGradientPickerControl, { 447 onChange: (value) => updateMeta(value, backgroundGradientKey), 448 value: meta[backgroundGradientKey] 449 }), 450 !!meta[backgroundUrlKey] && e(RangeControl, { 451 label: __('Opacity', 'slide'), 452 help: __('May be overridden by the block!'), 453 value: meta[backgroundOpacityKey] ? 100 - parseInt(meta[backgroundOpacityKey], 10) : undefined, 454 min: 0, 455 max: 100, 456 initialPosition: 0, 457 onChange: (value) => { 458 editPost({ 459 meta: { 460 ...meta, 461 [backgroundOpacityKey]: 100 - value + '' 462 } 463 }); 464 } 465 }) 466 ), 467 e( 468 PluginDocumentSettingPanel, 469 { 470 name: 'slide-background-image', 471 title: __('Background Image', 'slide'), 472 icon: 'format-image' 473 }, 474 e(MediaUpload, { 475 onSelect: (media) => { 476 if (!media || !media.url) { 477 editPost({ 478 meta: { 479 ...meta, 480 [backgroundUrlKey]: undefined, 481 [backgroundIdKey]: undefined, 482 [backgroundPositionKey]: undefined, 483 [backgroundOpacityKey]: undefined 484 } 485 }); 486 return; 487 } 488 489 editPost({ 490 meta: { 491 ...meta, 492 [backgroundUrlKey]: media.url, 493 [backgroundIdKey]: media.id + '' 494 } 495 }); 496 }, 497 allowedTypes: ALLOWED_MEDIA_TYPES, 498 value: meta[backgroundIdKey] ? parseInt(meta[backgroundIdKey], 10) : undefined, 499 render: ({ open }) => e(Button, { 500 isDefault: true, 501 onClick: open 502 }, meta[backgroundUrlKey] ? __('Change') : __('Add Background Image')) 503 }), 504 ' ', 505 !!meta[backgroundUrlKey] && e(Button, { 506 isDefault: true, 507 onClick: () => { 508 editPost({ 509 meta: { 510 ...meta, 511 [backgroundUrlKey]: '', 512 [backgroundIdKey]: '', 513 [backgroundPositionKey]: '', 514 [backgroundOpacityKey]: '' 515 } 516 }); 517 } 518 }, __('Remove')), 519 e('br'), e('br'), 520 !!meta[backgroundUrlKey] && e(FocalPointPicker, { 521 label: __('Focal Point Picker'), 522 url: meta[backgroundUrlKey], 523 value: (() => { 524 if (!meta[backgroundPositionKey]) { 525 return; 526 } 527 528 let [x, y] = meta[backgroundPositionKey].split(' '); 529 530 x = parseFloat(x) / 100; 531 y = parseFloat(y) / 100; 532 533 return { x, y }; 534 })(), 535 onChange: (focalPoint) => { 536 editPost({ 537 meta: { 538 ...meta, 539 [backgroundPositionKey]: `${focalPoint.x * 100}% ${focalPoint.y * 100}%` 540 } 541 }); 542 } 543 }), 544 !!meta[backgroundUrlKey] && e(RangeControl, { 545 label: __('Opacity', 'slide'), 546 help: __('May be overridden by the block!'), 547 value: meta[backgroundOpacityKey] ? parseInt(meta[backgroundOpacityKey], 10) : undefined, 548 min: 0, 549 max: 100, 550 initialPosition: 100, 551 onChange: (value) => { 552 editPost({ 553 meta: { 554 ...meta, 555 [backgroundOpacityKey]: value + '' 556 } 557 }); 558 } 559 }) 560 ), 561 e( 562 PluginDocumentSettingPanel, 563 { 564 name: 'slide-palette', 565 title: __('Color Palette', 'slide'), 566 icon: 'art' 567 }, 568 e(TextareaControl, { 569 label: __('Comma separated list of color values. Please refresh the page to be able to use the palette.', 'slide'), 570 value: meta[colorPaletteKey], 571 onChange: (value) => updateMeta(value, colorPaletteKey) 572 }) 573 ), 574 e( 575 PluginDocumentSettingPanel, 576 { 577 name: 'slide-css', 578 title: __('Custom CSS', 'slide'), 579 icon: 'editor-code' 580 }, 581 e(CodeEditor, { 582 value: meta[cssKey] || '/* Always a block prefix! */\n.wp-block-slide-slide {\n\t\n}\n', 583 onChange: (value) => updateMeta(value, cssKey) 584 }) 585 ), 586 e( 587 PluginDocumentSettingPanel, 588 { 589 name: 'slide-transition', 590 title: __('Transition', 'slide'), 591 icon: 'slides' 592 }, 593 e(SelectControl, { 594 label: __('Transition Style', 'slide'), 595 options: [ 596 { value: 'none', label: __('None', 'slide') }, 597 { value: 'fade', label: __('Fade', 'slide') }, 598 { value: 'slide', label: __('Slide', 'slide') }, 599 { value: 'convex', label: __('Convex', 'slide') }, 600 { value: 'concave', label: __('Concave', 'slide') }, 601 { value: 'zoom', label: __('Zoom', 'slide') } 602 ], 603 value: meta[transitionKey], 604 onChange: (value) => updateMeta(value, transitionKey) 605 }), 606 e(SelectControl, { 607 label: __('Background Transition Style', 'slide'), 608 options: [ 609 { value: 'none', label: __('None', 'slide') }, 610 { value: 'fade', label: __('Fade', 'slide') }, 611 { value: 'slide', label: __('Slide', 'slide') }, 612 { value: 'convex', label: __('Convex', 'slide') }, 613 { value: 'concave', label: __('Concave', 'slide') }, 614 { value: 'zoom', label: __('Zoom', 'slide') } 615 ], 616 value: meta[backgroundTransitionKey], 617 onChange: (value) => updateMeta(value, backgroundTransitionKey) 618 }), 619 e(SelectControl, { 620 label: __('Transition Speed', 'slide'), 621 options: [ 622 { value: 'default', label: __('Default', 'slide') }, 623 { value: 'fast', label: __('Fast', 'slide') }, 624 { value: 'slow', label: __('Slow', 'slide') } 625 ], 626 value: meta[transitionSpeedKey], 627 onChange: (value) => updateMeta(value, transitionSpeedKey) 628 }) 629 ), 630 e( 631 PluginDocumentSettingPanel, 632 { 633 name: 'slide-controls', 634 title: __('Controls', 'slide'), 635 icon: 'leftright' 636 }, 637 e(ToggleControl, { 638 label: __('Control Arrows', 'slide'), 639 checked: meta[controlsKey] === 'true', 640 onChange: (value) => updateMeta(value + '', controlsKey) 641 }), 642 e(ToggleControl, { 643 label: __('Progress Bar', 'slide'), 644 checked: meta[progressKey] === 'true', 645 onChange: (value) => updateMeta(value + '', progressKey) 646 }) 647 ), 648 e( 649 PluginDocumentSettingPanel, 650 { 651 name: 'slide-pdf', 652 title: __('PDF (Experimental)', 'slide'), 653 icon: 'page' 654 }, 655 e( 656 'p', 657 {}, 658 e( 659 ExternalLink, 660 { 661 href: addQueryArgs(link, { 'print-pdf': true }), 662 target: '_blank' 663 }, 664 __('Print (Save as PDF).', 'slides') 665 ), 666 e('br'), 667 __('Enable backgrounds and remove margins.', 'slides') 668 ) 669 ) 670 ]; 671 } 672 }); 673 674 const ALLOWED_MEDIA_TYPES = ['image']; 675 676 registerBlockType('slide/slide', { 677 title: __('Slide', 'slide'), 678 description: __('With this blocks you can form your slide deck! You can override document level setting for each slide block.'), 679 icon: 'slides', 680 category: 'common', 681 keywords: [__('Presentation', 'slide')], 682 attributes: { 683 notes: { 684 type: 'string' 685 }, 686 color: { 687 type: 'string' 688 }, 689 backgroundColor: { 690 type: 'string' 691 }, 692 backgroundId: { 693 type: 'string' 694 }, 695 backgroundUrl: { 696 type: 'string' 697 }, 698 focalPoint: { 699 type: 'object' 700 }, 701 backgroundOpacity: { 702 type: 'string' 703 }, 704 backgroundSize: { 705 type: 'string' 706 }, 707 hidden: { 708 type: 'boolean' 709 }, 710 backgroundIframeUrl: { 711 type: 'string' 712 } 713 }, 714 edit: ({ attributes, setAttributes, className }) => { 715 const meta = useSelect((select) => 716 select('core/editor').getEditedPostAttribute('meta') 717 ); 718 719 return e( 720 Fragment, 721 null, 722 e( 723 InspectorControls, 724 null, 725 e( 726 PanelBody, 727 { 728 title: __('Speaker Notes', 'slide'), 729 icon: 'edit', 730 initialOpen: false 731 }, 732 e(TextareaControl, { 733 label: __('Anything you want to remember.', 'slide'), 734 value: attributes.notes, 735 onChange: (notes) => setAttributes({ notes }), 736 rows: 10 737 }) 738 ), 739 e( 740 PanelBody, 741 { 742 title: __('Font', 'slide'), 743 icon: 'text', 744 initialOpen: false 745 }, 746 e(ColorPalette, { 747 label: __('Color', 'slide'), 748 value: attributes.color, 749 onChange: (color) => 750 setAttributes({ color }) 751 }), 752 !!attributes.color && e(Button, { 753 isDefault: true, 754 onClick: () => { 755 setAttributes({ 756 color: undefined 757 }); 758 } 759 }, __('Remove')) 760 ), 761 e( 762 PanelBody, 763 { 764 title: __('Background Color', 'slide'), 765 icon: 'art', 766 initialOpen: false 767 }, 768 e(ColorPalette, { 769 label: __('Background Color', 'slide'), 770 value: attributes.backgroundColor, 771 onChange: (backgroundColor) => 772 setAttributes({ backgroundColor }) 773 }), 774 (attributes.backgroundUrl || meta[backgroundUrlKey]) && 775 e(RangeControl, { 776 label: __('Opacity', 'slide'), 777 value: attributes.backgroundOpacity ? 100 - parseInt(attributes.backgroundOpacity, 10) : undefined, 778 min: 0, 779 max: 100, 780 initialPosition: 0, 781 onChange: (value) => { 782 if (value === undefined) { 783 setAttributes({ 784 backgroundOpacity: undefined 785 }); 786 } else { 787 setAttributes({ 788 backgroundOpacity: 100 - value + '' 789 }); 790 } 791 } 792 }), 793 !!attributes.backgroundColor && e(Button, { 794 isDefault: true, 795 onClick: () => { 796 setAttributes({ 797 backgroundColor: undefined 798 }); 799 } 800 }, __('Remove')) 801 ), 802 e( 803 PanelBody, 804 { 805 title: __('Background Image', 'slide'), 806 icon: 'format-image', 807 initialOpen: false 808 }, 809 e(MediaUpload, { 810 onSelect: (media) => { 811 if (!media || !media.url) { 812 setAttributes({ 813 backgroundUrl: undefined, 814 backgroundId: undefined, 815 backgroundSize: undefined, 816 focalPoint: undefined 817 }); 818 return; 819 } 820 821 setAttributes({ 822 backgroundUrl: media.url, 823 backgroundId: media.id 824 }); 825 }, 826 allowedTypes: ALLOWED_MEDIA_TYPES, 827 value: attributes.backgroundId, 828 render: ({ open }) => e(Button, { 829 isDefault: true, 830 onClick: open 831 }, attributes.backgroundUrl ? __('Change') : __('Add Background Image')) 832 }), 833 ' ', 834 !!attributes.backgroundUrl && e(Button, { 835 isDefault: true, 836 onClick: () => { 837 setAttributes({ 838 backgroundUrl: undefined, 839 backgroundId: undefined, 840 backgroundSize: undefined, 841 focalPoint: undefined 842 }); 843 } 844 }, __('Remove')), 845 e('br'), e('br'), 846 !!attributes.backgroundUrl && e(FocalPointPicker, { 847 label: __('Focal Point Picker'), 848 url: attributes.backgroundUrl, 849 value: attributes.focalPoint, 850 onChange: (focalPoint) => setAttributes({ focalPoint }) 851 }), 852 !!attributes.backgroundUrl && e(RangeControl, { 853 label: __('Opacity', 'slide'), 854 value: attributes.backgroundOpacity ? parseInt(attributes.backgroundOpacity, 10) : undefined, 855 min: 0, 856 max: 100, 857 initialPosition: 100, 858 onChange: (value) => setAttributes({ 859 backgroundOpacity: value + '' 860 }) 861 }), 862 !!attributes.backgroundUrl && e(RadioControl, { 863 label: __('Size', 'slide'), 864 selected: attributes.backgroundSize, 865 options: [ 866 { label: __('Cover'), value: 'cover' }, 867 { label: __('Contain'), value: 'contain' } 868 ], 869 onChange: (backgroundSize) => setAttributes({ 870 backgroundSize 871 }) 872 }) 873 ), 874 e( 875 PanelBody, 876 { 877 title: __('Background Iframe', 'slide'), 878 icon: 'format-video', 879 initialOpen: false 880 }, 881 e(TextControl, { 882 label: __('Iframe URL'), 883 value: attributes.backgroundIframeUrl, 884 onChange: (backgroundIframeUrl) => setAttributes({ backgroundIframeUrl }) 885 }), 886 e('br'), e('br'), 887 !!attributes.backgroundIframeUrl && e(RangeControl, { 888 label: __('Opacity', 'slide'), 889 value: attributes.backgroundOpacity ? parseInt(attributes.backgroundOpacity, 10) : undefined, 890 min: 0, 891 max: 100, 892 initialPosition: 100, 893 onChange: (value) => setAttributes({ 894 backgroundOpacity: value + '' 895 }) 896 }) 897 ), 898 e( 899 PanelBody, 900 { 901 title: __('Visibility', 'slide'), 902 icon: 'visibility', 903 initialOpen: false 904 }, 905 e(ToggleControl, { 906 label: __('Hide Slide', 'slide'), 907 checked: attributes.hidden, 908 onChange: (hidden) => setAttributes({ hidden }) 909 }) 910 ) 911 ), 912 attributes.hidden && e( 913 Notice, 914 { status: 'warning', isDismissible: false }, 915 'This slide is hidden' 916 ), 917 e( 918 'div', 919 { 920 className: 'wp-block-slide-slide__body', 921 style: { 922 color: attributes.color || undefined, 923 backgroundColor: attributes.backgroundColor || undefined, 924 // If a background color is set, disable the global gradient. 925 backgroundImage: attributes.backgroundColor ? 'none' : undefined 926 } 927 }, 928 e( 929 'div', 930 { 931 className: 'wp-block-slide-slide__background', 932 style: { 933 backgroundImage: attributes.backgroundUrl ? `url("${attributes.backgroundUrl}")` : undefined, 934 backgroundPosition: attributes.focalPoint ? `${attributes.focalPoint.x * 100}% ${attributes.focalPoint.y * 100}%` : undefined, 935 backgroundSize: attributes.backgroundSize ? attributes.backgroundSize : undefined, 936 opacity: attributes.backgroundOpacity ? attributes.backgroundOpacity / 100 : undefined 937 } 938 }, 939 !!attributes.backgroundIframeUrl && e('iframe', { 940 src: attributes.backgroundIframeUrl 941 }) 942 ), 943 e( 944 'section', 945 { className }, 946 e(InnerBlocks) 947 ) 948 ) 949 ); 950 }, 951 save: ({ attributes }) => e( 952 attributes.hidden ? 'div' : 'section', 953 { 954 style: { 955 color: attributes.color || undefined, 956 display: attributes.hidden ? 'none' : undefined 957 }, 958 'data-background-color': attributes.backgroundColor || undefined, 959 'data-background-image': attributes.backgroundUrl ? attributes.backgroundUrl : undefined, 960 'data-background-position': attributes.focalPoint ? `${attributes.focalPoint.x * 100}% ${attributes.focalPoint.y * 100}%` : undefined, 961 'data-background-opacity': attributes.backgroundOpacity ? attributes.backgroundOpacity / 100 : undefined, 962 'data-background-iframe': attributes.backgroundIframeUrl ? attributes.backgroundIframeUrl : undefined, 963 'data-background-size': attributes.backgroundSize ? attributes.backgroundSize : undefined 964 }, 965 e(InnerBlocks.Content) 966 ) 967 }); 968 969 registerFormatType('slide/fragment', { 970 title: __('Slide Fragment', 'slide'), 971 tagName: 'span', 972 className: 'fragment', 973 edit: ({ value, onChange }) => 974 e(RichTextToolbarButton, { 975 icon: 'editor-textcolor', 976 title: __('Slide Fragment', 'slide'), 977 onClick: () => { 978 onChange(toggleFormat(value, { type: 'slide/fragment' })); 979 } 980 }) 981 }); 982 983 window.addEventListener('DOMContentLoaded', resize); 984 985 function resize () { 986 const element = document.querySelector('.block-editor-writing-flow'); 987 988 if (!element) { 989 window.requestAnimationFrame(resize); 990 return; 991 } 992 993 const width = element.clientWidth; 994 const parentWidth = element.parentNode.clientWidth; 995 const margin = parentWidth / 26; 996 const innerParentWidth = element.parentNode.clientWidth - margin * 2; 997 const scale = Math.min(1, innerParentWidth / width); 998 const marginLeft = scale === 1 ? ((innerParentWidth - width) / 2) + margin : margin; 999 const transform = `translate(${marginLeft}px, ${margin}px) scale(${scale})`; 1000 1001 if (element.style.transform !== transform) { 1002 element.style.transformOrigin = '0 0'; 1003 element.style.transform = transform; 1004 } 1005 1006 window.requestAnimationFrame(resize); 1007 } 1008 })( 1009 window.wp, 1010 window.slide 1011 ); 1012 (({ 1013 hooks: { addFilter }, 1014 element: { createElement: e, Fragment: f }, 1015 blockEditor: { InspectorControls }, 1016 components: { PanelBody, TextControl, SelectControl }, 1017 i18n: { __ } 1018 }, { FontPicker }) => { 1019 const allowedBlocks = new Set(['core/paragraph']); 1020 1021 addFilter( 1022 'blocks.registerBlockType', 1023 'slide/register-block-attributes', 1024 (settings) => { 1025 if (!allowedBlocks.has(settings.name)) { 1026 return settings; 1027 } 1028 1029 return { 1030 ...settings, 1031 attributes: { 1032 ...settings.attributes, 1033 fontFamily: { 1034 type: 'string' 1035 }, 1036 fontWeight: { 1037 type: 'string' 1038 } 1039 } 1040 }; 1041 } 1042 ); 1043 1044 addFilter( 1045 'editor.BlockEdit', 1046 'slide/control-block-attributes', 1047 (BlockEdit) => { 1048 return (props) => { 1049 const { attributes, setAttributes, isSelected, name } = props; 1050 return e( 1051 f, 1052 null, 1053 e(BlockEdit, props), 1054 isSelected && allowedBlocks.has(name) && e( 1055 InspectorControls, 1056 null, 1057 e( 1058 PanelBody, 1059 { 1060 title: __('Font', 'slide'), 1061 icon: 'format-text', 1062 initialOpen: false 1063 }, 1064 e(FontPicker, { 1065 label: __('Font Family', 'slide'), 1066 value: attributes.fontFamily, 1067 onChange: (fontFamily) => setAttributes({ fontFamily }) 1068 }), 1069 e(SelectControl, { 1070 label: __('Font Weight', 'slide'), 1071 help: __('Depending on the Font, some options may not be available.'), 1072 options: [ 1073 { value: '100', label: __('Thin', 'slide') }, 1074 { value: '200', label: __('Extra Light', 'slide') }, 1075 { value: '300', label: __('Light', 'slide') }, 1076 { value: '400', label: __('Normal', 'slide') }, 1077 { value: '500', label: __('Medium', 'slide') }, 1078 { value: '600', label: __('Semi Bold', 'slide') }, 1079 { value: '700', label: __('Bold', 'slide') }, 1080 { value: '800', label: __('Extra Bold', 'slide') }, 1081 { value: '900', label: __('Black', 'slide') } 1082 ], 1083 value: attributes.fontWeight || '400', 1084 onChange: (fontWeight) => setAttributes({ fontWeight }) 1085 }) 1086 ) 1087 ) 1088 ); 1089 }; 1090 } 1091 ); 1092 1093 addFilter( 1094 'editor.BlockListBlock', 1095 'slide/edit-block-attributes', 1096 (BlockListBlock) => { 1097 return (props) => { 1098 if (allowedBlocks.has(props.block.name)) { 1099 const { wrapperProps = {}, attributes } = props; 1100 const { style = {} } = wrapperProps; 1101 const { fontFamily, fontWeight } = attributes; 1102 1103 if (fontFamily) { 1104 props = { 1105 ...props, 1106 wrapperProps: { 1107 ...wrapperProps, 1108 style: { 1109 ...style, 1110 fontFamily, 1111 fontWeight 1112 } 1113 } 1114 }; 1115 } 1116 } 1117 1118 return e(BlockListBlock, props); 1119 }; 1120 } 1121 ); 1122 1123 addFilter( 1124 'blocks.getSaveContent.extraProps', 1125 'slide/save-block-attributes', 1126 (extraProps, blockType, attributes) => { 1127 if (!allowedBlocks.has(blockType.name)) { 1128 return extraProps; 1129 } 1130 1131 const { fontFamily, fontWeight } = attributes; 1132 const { style = {} } = extraProps; 1133 1134 return { 1135 ...extraProps, 1136 style: { 1137 ...style, 1138 fontFamily, 1139 fontWeight 1140 } 1141 }; 1142 } 1143 ); 1144 })(window.wp, window.slide); 1248 var _meta$backgroundPosit = meta[backgroundPositionKey].split(' '), 1249 _meta$backgroundPosit2 = _slicedToArray(_meta$backgroundPosit, 2), 1250 x = _meta$backgroundPosit2[0], 1251 y = _meta$backgroundPosit2[1]; 1252 1253 x = parseFloat(x) / 100; 1254 y = parseFloat(y) / 100; 1255 return { 1256 x: x, 1257 y: y 1258 }; 1259 }(), 1260 onChange: function onChange(focalPoint) { 1261 editPost({ 1262 meta: _objectSpread({}, meta, _defineProperty({}, backgroundPositionKey, "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%"))) 1263 }); 1264 } 1265 }), !!meta[backgroundUrlKey] && e(RangeControl, { 1266 label: __('Opacity', 'slide'), 1267 help: __('May be overridden by the block!'), 1268 value: meta[backgroundOpacityKey] ? parseInt(meta[backgroundOpacityKey], 10) : undefined, 1269 min: 0, 1270 max: 100, 1271 initialPosition: 100, 1272 onChange: function onChange(value) { 1273 editPost({ 1274 meta: _objectSpread({}, meta, _defineProperty({}, backgroundOpacityKey, value + '')) 1275 }); 1276 } 1277 })), e(PluginDocumentSettingPanel, { 1278 name: 'slide-palette', 1279 title: __('Color Palette', 'slide'), 1280 icon: 'art' 1281 }, e(TextareaControl, { 1282 label: __('Comma separated list of color values. Please refresh the page to be able to use the palette.', 'slide'), 1283 value: meta[colorPaletteKey], 1284 onChange: function onChange(value) { 1285 return updateMeta(value, colorPaletteKey); 1286 } 1287 })), e(PluginDocumentSettingPanel, { 1288 name: 'slide-css', 1289 title: __('Custom CSS', 'slide'), 1290 icon: 'editor-code' 1291 }, e(_codeEditor.default, { 1292 value: meta[cssKey] || '/* Always a block prefix! */\n.wp-block-slide-slide {\n\t\n}\n', 1293 onChange: function onChange(value) { 1294 return updateMeta(value, cssKey); 1295 } 1296 })), e(PluginDocumentSettingPanel, { 1297 name: 'slide-transition', 1298 title: __('Transition', 'slide'), 1299 icon: 'slides' 1300 }, e(SelectControl, { 1301 label: __('Transition Style', 'slide'), 1302 options: [{ 1303 value: 'none', 1304 label: __('None', 'slide') 1305 }, { 1306 value: 'fade', 1307 label: __('Fade', 'slide') 1308 }, { 1309 value: 'slide', 1310 label: __('Slide', 'slide') 1311 }, { 1312 value: 'convex', 1313 label: __('Convex', 'slide') 1314 }, { 1315 value: 'concave', 1316 label: __('Concave', 'slide') 1317 }, { 1318 value: 'zoom', 1319 label: __('Zoom', 'slide') 1320 }], 1321 value: meta[transitionKey], 1322 onChange: function onChange(value) { 1323 return updateMeta(value, transitionKey); 1324 } 1325 }), e(SelectControl, { 1326 label: __('Background Transition Style', 'slide'), 1327 options: [{ 1328 value: 'none', 1329 label: __('None', 'slide') 1330 }, { 1331 value: 'fade', 1332 label: __('Fade', 'slide') 1333 }, { 1334 value: 'slide', 1335 label: __('Slide', 'slide') 1336 }, { 1337 value: 'convex', 1338 label: __('Convex', 'slide') 1339 }, { 1340 value: 'concave', 1341 label: __('Concave', 'slide') 1342 }, { 1343 value: 'zoom', 1344 label: __('Zoom', 'slide') 1345 }], 1346 value: meta[backgroundTransitionKey], 1347 onChange: function onChange(value) { 1348 return updateMeta(value, backgroundTransitionKey); 1349 } 1350 }), e(SelectControl, { 1351 label: __('Transition Speed', 'slide'), 1352 options: [{ 1353 value: 'default', 1354 label: __('Default', 'slide') 1355 }, { 1356 value: 'fast', 1357 label: __('Fast', 'slide') 1358 }, { 1359 value: 'slow', 1360 label: __('Slow', 'slide') 1361 }], 1362 value: meta[transitionSpeedKey], 1363 onChange: function onChange(value) { 1364 return updateMeta(value, transitionSpeedKey); 1365 } 1366 })), e(PluginDocumentSettingPanel, { 1367 name: 'slide-controls', 1368 title: __('Controls', 'slide'), 1369 icon: 'leftright' 1370 }, e(ToggleControl, { 1371 label: __('Control Arrows', 'slide'), 1372 checked: meta[controlsKey] === 'true', 1373 onChange: function onChange(value) { 1374 return updateMeta(value + '', controlsKey); 1375 } 1376 }), e(ToggleControl, { 1377 label: __('Progress Bar', 'slide'), 1378 checked: meta[progressKey] === 'true', 1379 onChange: function onChange(value) { 1380 return updateMeta(value + '', progressKey); 1381 } 1382 })), e(PluginDocumentSettingPanel, { 1383 name: 'slide-pdf', 1384 title: __('PDF (Experimental)', 'slide'), 1385 icon: 'page' 1386 }, e('p', {}, e(ExternalLink, { 1387 href: addQueryArgs(link, { 1388 'print-pdf': true 1389 }), 1390 target: '_blank' 1391 }, __('Print (Save as PDF).', 'slides')), e('br'), __('Enable backgrounds and remove margins.', 'slides')))]); 1392 } 1393 }); 1394 },{"./font-picker":"eotu","./font-weight-picker":"aPnW","./code-editor":"wMKM"}],"BZ3n":[function(require,module,exports) { 1395 "use strict"; 1396 1397 require("./block-attributes"); 1398 1399 require("./resize"); 1400 1401 require("./data-subscription"); 1402 1403 require("./fragment"); 1404 1405 require("./block"); 1406 1407 require("./plugin"); 1408 },{"./block-attributes":"HZbO","./resize":"Xy8f","./data-subscription":"XUD5","./fragment":"S1sO","./block":"W9ez","./plugin":"GOVZ"}]},{},["BZ3n"], null) 1409 //# sourceMappingURL=/index.js.map -
slide/trunk/index.php
r2180951 r2181106 5 5 * Plugin URI: https://wordpress.org/plugins/slide/ 6 6 * Description: Allows you to create presentations with the block editor. 7 * Version: 0.0.2 37 * Version: 0.0.24 8 8 * Author: Ella van Durpe 9 9 * Author URI: https://ellavandurpe.com … … 237 237 238 238 add_filter( 'block_editor_settings', function( $settings ) { 239 if ( get_current_screen()->post_type !== 'presentation' ) { 240 return $settings; 241 } 242 239 243 $settings['styles'] = array(); 240 244 return $settings; -
slide/trunk/readme.md
r2180951 r2181106 6 6 Requires PHP: 5.6 7 7 Tested up to: 5.3 8 Stable tag: 0.0.2 38 Stable tag: 0.0.24 9 9 License: GPL-2.0-or-later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
slide/trunk/template.php
r2180951 r2181106 167 167 width: <?php echo get_post_meta( get_the_ID(), 'presentation-width', true ) ?: '960'; ?>, 168 168 margin: 0.08, 169 keyboard: { 170 38: 'prev', 171 40: 'next', 172 }, 169 173 // minScale: 1, 170 174 // maxScale: 1,
Note: See TracChangeset
for help on using the changeset viewer.