Updated tabler to 1.0.0-beta20

This commit is contained in:
Pinga 2023-08-29 11:37:36 +03:00
parent 9fafe701aa
commit ae0bfb08f3
429 changed files with 28170 additions and 18920 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@ export interface CountUpOptions {
decimalPlaces?: number;
duration?: number;
useGrouping?: boolean;
useIndianSeparators?: boolean;
useEasing?: boolean;
smartEasingThreshold?: number;
smartEasingAmount?: number;
@ -16,22 +17,26 @@ export interface CountUpOptions {
enableScrollSpy?: boolean;
scrollSpyDelay?: number;
scrollSpyOnce?: boolean;
onCompleteCallback?: () => any;
plugin?: CountUpPlugin;
}
export declare interface CountUpPlugin {
render(elem: HTMLElement, formatted: string): void;
}
export declare class CountUp {
private endVal;
options?: CountUpOptions;
version: string;
private defaults;
private el;
private rAF;
private startTime;
private remaining;
private finalEndVal;
private useEasing;
private countDown;
el: HTMLElement | HTMLInputElement;
formattingFn: (num: number) => string;
easingFn?: (t: number, b: number, c: number, d: number) => number;
callback: (args?: any) => any;
error: string;
startVal: number;
duration: number;
@ -44,7 +49,7 @@ export declare class CountUp {
* Smart easing works by breaking the animation into 2 parts, the second part being the
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
* by disabling easing for the first part and enabling it on the second part. It is used if
* usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
*/
private determineDirectionAndSmartEasing;
start(callback?: (args?: any) => any): void;

View file

@ -15,13 +15,14 @@ var CountUp = /** @class */ (function () {
var _this = this;
this.endVal = endVal;
this.options = options;
this.version = '2.3.2';
this.version = '2.6.2';
this.defaults = {
startVal: 0,
decimalPlaces: 0,
duration: 2,
useEasing: true,
useGrouping: true,
useIndianSeparators: false,
smartEasingThreshold: 999,
smartEasingAmount: 333,
separator: ',',
@ -73,8 +74,8 @@ var CountUp = /** @class */ (function () {
_this.update(_this.finalEndVal);
}
else {
if (_this.callback) {
_this.callback();
if (_this.options.onCompleteCallback) {
_this.options.onCompleteCallback();
}
}
};
@ -89,10 +90,16 @@ var CountUp = /** @class */ (function () {
x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
if (_this.options.useGrouping) {
x3 = '';
var factor = 3, j = 0;
for (var i = 0, len = x1.length; i < len; ++i) {
if (i !== 0 && (i % 3) === 0) {
if (_this.options.useIndianSeparators && i === 4) {
factor = 2;
j = 1;
}
if (i !== 0 && (j % factor) === 0) {
x3 = _this.options.separator + x3;
}
j++;
x3 = x1[len - i - 1] + x3;
}
x1 = x3;
@ -151,6 +158,7 @@ var CountUp = /** @class */ (function () {
return;
var bottomOfScroll = window.innerHeight + window.scrollY;
var rect = self.el.getBoundingClientRect();
var topOfEl = rect.top + window.pageYOffset;
var bottomOfEl = rect.top + rect.height + window.pageYOffset;
if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
// in view
@ -159,8 +167,9 @@ var CountUp = /** @class */ (function () {
if (self.options.scrollSpyOnce)
self.once = true;
}
else if (window.scrollY > bottomOfEl && !self.paused) {
// scrolled past
else if ((window.scrollY > bottomOfEl || topOfEl > bottomOfScroll) &&
!self.paused) {
// out of view
self.reset();
}
};
@ -168,7 +177,7 @@ var CountUp = /** @class */ (function () {
* Smart easing works by breaking the animation into 2 parts, the second part being the
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
* by disabling easing for the first part and enabling it on the second part. It is used if
* usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
*/
CountUp.prototype.determineDirectionAndSmartEasing = function () {
var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
@ -197,7 +206,9 @@ var CountUp = /** @class */ (function () {
if (this.error) {
return;
}
this.callback = callback;
if (callback) {
this.options.onCompleteCallback = callback;
}
if (this.duration > 0) {
this.determineDirectionAndSmartEasing();
this.paused = false;
@ -247,7 +258,14 @@ var CountUp = /** @class */ (function () {
this.rAF = requestAnimationFrame(this.count);
};
CountUp.prototype.printValue = function (val) {
var _a;
if (!this.el)
return;
var result = this.formattingFn(val);
if ((_a = this.options.plugin) === null || _a === void 0 ? void 0 : _a.render) {
this.options.plugin.render(this.el, result);
return;
}
if (this.el.tagName === 'INPUT') {
var input = this.el;
input.value = result;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,26 @@
// make sure requestAnimationFrame and cancelAnimationFrame are defined
// polyfill for browsers without native support
// by Opera engineer Erik Möller
(function () {
var lastTime = 0;
var vendors = ['webkit', 'moz', 'ms', 'o'];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
window[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function (callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function () { return callback(currTime + timeToCall); }, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
if (!window.cancelAnimationFrame) {
window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
})();

View file

@ -1,54 +1,60 @@
# Fullscreen Lightbox Basic
# Vanilla JavaScript Fullscreen Lightbox Basic
## Description
Modern and easy plugin for displaying images and videos in clean overlaying box.
Display single source or create beautiful gallery with powerful lightbox.
A vanilla JavaScript plug-in without production dependencies for displaying images, videos, or, through custom sources, anything you want in a clean overlying box.
The project's website: https://fslightbox.com.
Website: https://fslightbox.com
### No jQuery and other dependencies.
## Basic usage
### Installation
```
npm install fslightbox
```
### Example
In your application .js file:
```javascript
require('fslightbox');
```
In HTML file
## Installation
### Through an archive downloaded from the website.
Just before the end of the &lt;body&gt; tag:
```html
<a data-fslightbox="gallery" href="https://i.imgur.com/fsyrScY.jpg">
Open first slide (image)
</a>
<a data-fslightbox="gallery" href="https://www.youtube.com/watch?v=xshEZzpS4CQ">
Open second slide (YouTube)
</a>
<a data-fslightbox="gallery" href="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4">
Open third slide (HTML video)
</a>
<a data-fslightbox="gallery" href="#vimeo">
Open fourth slide (custom source)
</a>
<iframe id="vimeo" src="https://player.vimeo.com/video/22439234" width="1920px" height="1080px"
frameBorder="0" allow="autoplay; fullscreen" allowFullScreen />
<script src="fslightbox.js"></script>
```
### Or, through a package manager.
```
npm install fslightbox
```
And import it in your project's JavaScript file, for example through the Node.js "require" function:
```
require("fslightbox")
```
## Demo
Available at: https://fslightbox.com/javascript
## Basic usage
```html
<a data-fslightbox="gallery" href="https://i.imgur.com/fsyrScY.jpg">
Open the first slide (an image)
</a>
<a
data-fslightbox="gallery"
href="https://www.youtube.com/watch?v=xshEZzpS4CQ"
>
Open the second slide (a YouTube video)
</a>
<a
data-fslightbox="gallery"
href="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
>
Open the third slide (an HTML video)
</a>
<a data-fslightbox="gallery" href="#vimeo">
Open the fourth slide (a Vimeo video—a custom source)
</a>
<iframe
id="vimeo"
src="https://player.vimeo.com/video/22439234"
width="1920px"
height="1080px"
frameBorder="0"
allow="autoplay; fullscreen"
allowFullScreen
></iframe>
```
## Documentation
Available at: https://fslightbox.com/javascript/documentation
Available at: https://fslightbox.com/javascript/documentation.
## Demo
Available at: https://fslightbox.com/javascript.
## Browser Compatibility

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"name": "fslightbox",
"version": "3.3.1",
"description": "Modern and easy plugin for displaying images and videos in clean overlaying box. Display single source or create beautiful gallery with powerful lightbox.",
"version": "3.4.1",
"description": "An easy to use vanilla JavaScript plug-in without production dependencies for displaying images, videos, or, through custom sources, anything you want in a clean overlying box.",
"author": "Bantha Apps Piotr Zdziarski",
"license": "MIT",
"homepage": "https://fslightbox.com",
@ -10,61 +10,27 @@
},
"main": "index.js",
"keywords": [
"lightbox",
"slide gallery",
"image lightbox",
"slider",
"carousel"
"fslightbox",
"vanilla javascript fslightbox",
"vanilla js fslightbox",
"vanilla javascript lightbox",
"vanilla js lightbox",
"lightbox"
],
"repository": {
"type": "git",
"url": "git+https://github.com/banthagroup/fslightbox"
},
"scripts": {
"test": "jest",
"production": "webpack --mode production --config webpack.prod.config.js --display-modules && gulp",
"watch": "webpack-dev-server --mode development --host 0.0.0.0",
"cypress": "concurrently --kill-others \"webpack-dev-server --config ./webpack.cypress.config.js --mode development\" \"node ./node_modules/.bin/cypress open\""
},
"jest": {
"setupFiles": [
"./jest-setup.js"
],
"verbose": true,
"testPathIgnorePatterns": [
"/node_modules/",
"/demo/",
"/dist/",
"/tests/cypress/"
],
"collectCoverage": false
"w": "webpack-dev-server --host 0.0.0.0",
"p": "webpack --config webpack.prod.config.js && cp index.js fslightbox.js"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/register": "^7.4.4",
"babel-jest": "^24.7.1",
"babel-loader": "^8.0.5",
"babel-polyfill": "^6.26.0",
"browser-sync": "^2.26.7",
"concurrently": "^6.2.0",
"copy-webpack-plugin": "^5.0.3",
"core-js": "^3.0.1",
"css-loader": "^2.1.0",
"cypress": "^7.5.0",
"dotenv": "^10.0.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.2",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.7.1",
"node-sass": "^4.12.0",
"prop-types": "^15.6.2",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglifyjs-webpack-plugin": "^2.1.1",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.1",
"webpack-dev-server": "^3.3.1"

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,577 @@
.clr-picker {
display: none;
flex-wrap: wrap;
position: absolute;
width: 200px;
z-index: 1000;
border-radius: 10px;
background-color: #fff;
justify-content: flex-end;
direction: ltr;
box-shadow: 0 0 5px rgba(0,0,0,.05), 0 5px 20px rgba(0,0,0,.1);
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
.clr-picker.clr-open,
.clr-picker[data-inline="true"] {
display: flex;
}
.clr-picker[data-inline="true"] {
position: relative;
}
.clr-gradient {
position: relative;
width: 100%;
height: 100px;
margin-bottom: 15px;
border-radius: 3px 3px 0 0;
background-image: linear-gradient(rgba(0,0,0,0), #000), linear-gradient(90deg, #fff, currentColor);
cursor: pointer;
}
.clr-marker {
position: absolute;
width: 12px;
height: 12px;
margin: -6px 0 0 -6px;
border: 1px solid #fff;
border-radius: 50%;
background-color: currentColor;
cursor: pointer;
}
.clr-picker input[type="range"]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
}
.clr-picker input[type="range"]::-webkit-slider-thumb {
width: 8px;
height: 8px;
-webkit-appearance: none;
}
.clr-picker input[type="range"]::-moz-range-track {
width: 100%;
height: 8px;
border: 0;
}
.clr-picker input[type="range"]::-moz-range-thumb {
width: 8px;
height: 8px;
border: 0;
}
.clr-hue {
background-image: linear-gradient(to right, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
}
.clr-hue,
.clr-alpha {
position: relative;
width: calc(100% - 40px);
height: 8px;
margin: 5px 20px;
border-radius: 4px;
}
.clr-alpha span {
display: block;
height: 100%;
width: 100%;
border-radius: inherit;
background-image: linear-gradient(90deg, rgba(0,0,0,0), currentColor);
}
.clr-hue input,
.clr-alpha input {
position: absolute;
width: calc(100% + 16px);
height: 16px;
left: -8px;
top: -4px;
margin: 0;
background-color: transparent;
opacity: 0;
cursor: pointer;
appearance: none;
-webkit-appearance: none;
}
.clr-hue div,
.clr-alpha div {
position: absolute;
width: 16px;
height: 16px;
left: 0;
top: 50%;
margin-left: -8px;
transform: translateY(-50%);
border: 2px solid #fff;
border-radius: 50%;
background-color: currentColor;
box-shadow: 0 0 1px #888;
pointer-events: none;
}
.clr-alpha div:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
left: 0;
top: 0;
border-radius: 50%;
background-color: currentColor;
}
.clr-format {
display: none;
order: 1;
width: calc(100% - 40px);
margin: 0 20px 20px;
}
.clr-segmented {
display: flex;
position: relative;
width: 100%;
margin: 0;
padding: 0;
border: 1px solid #ddd;
border-radius: 15px;
box-sizing: border-box;
color: #999;
font-size: 12px;
}
.clr-segmented input,
.clr-segmented legend {
position: absolute;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: 0;
left: 0;
top: 0;
opacity: 0;
pointer-events: none;
}
.clr-segmented label {
flex-grow: 1;
margin: 0;
padding: 4px 0;
font-size: inherit;
font-weight: normal;
line-height: initial;
text-align: center;
cursor: pointer;
}
.clr-segmented label:first-of-type {
border-radius: 10px 0 0 10px;
}
.clr-segmented label:last-of-type {
border-radius: 0 10px 10px 0;
}
.clr-segmented input:checked + label {
color: #fff;
background-color: #666;
}
.clr-swatches {
order: 2;
width: calc(100% - 32px);
margin: 0 16px;
}
.clr-swatches div {
display: flex;
flex-wrap: wrap;
padding-bottom: 12px;
justify-content: center;
}
.clr-swatches button {
position: relative;
width: 20px;
height: 20px;
margin: 0 4px 6px 4px;
padding: 0;
border: 0;
border-radius: 50%;
color: inherit;
text-indent: -1000px;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
}
.clr-swatches button:after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
border-radius: inherit;
background-color: currentColor;
box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
input.clr-color {
order: 1;
width: calc(100% - 80px);
height: 32px;
margin: 15px 20px 20px auto;
padding: 0 10px;
border: 1px solid #ddd;
border-radius: 16px;
color: #444;
background-color: #fff;
font-family: sans-serif;
font-size: 14px;
text-align: center;
box-shadow: none;
}
input.clr-color:focus {
outline: none;
border: 1px solid #1e90ff;
}
.clr-close,
.clr-clear {
display: none;
order: 2;
height: 24px;
margin: 0 20px 20px;
padding: 0 20px;
border: 0;
border-radius: 12px;
color: #fff;
background-color: #666;
font-family: inherit;
font-size: 12px;
font-weight: 400;
cursor: pointer;
}
.clr-close {
display: block;
margin: 0 20px 20px auto;
}
.clr-preview {
position: relative;
width: 32px;
height: 32px;
margin: 15px 0 20px 20px;
border-radius: 50%;
overflow: hidden;
}
.clr-preview:before,
.clr-preview:after {
content: '';
position: absolute;
height: 100%;
width: 100%;
left: 0;
top: 0;
border: 1px solid #fff;
border-radius: 50%;
}
.clr-preview:after {
border: 0;
background-color: currentColor;
box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
.clr-preview button {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
margin: 0;
padding: 0;
border: 0;
border-radius: 50%;
outline-offset: -2px;
background-color: transparent;
text-indent: -9999px;
cursor: pointer;
overflow: hidden;
}
.clr-marker,
.clr-hue div,
.clr-alpha div,
.clr-color {
box-sizing: border-box;
}
.clr-field {
display: inline-block;
position: relative;
color: transparent;
}
.clr-field input {
margin: 0;
direction: ltr;
}
.clr-field.clr-rtl input {
text-align: right;
}
.clr-field button {
position: absolute;
width: 30px;
height: 100%;
right: 0;
top: 50%;
transform: translateY(-50%);
margin: 0;
padding: 0;
border: 0;
color: inherit;
text-indent: -1000px;
white-space: nowrap;
overflow: hidden;
pointer-events: none;
}
.clr-field.clr-rtl button {
right: auto;
left: 0;
}
.clr-field button:after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
border-radius: inherit;
background-color: currentColor;
box-shadow: inset 0 0 1px rgba(0,0,0,.5);
}
.clr-alpha,
.clr-alpha div,
.clr-swatches button,
.clr-preview:before,
.clr-field button {
background-image: repeating-linear-gradient(45deg, #aaa 25%, transparent 25%, transparent 75%, #aaa 75%, #aaa), repeating-linear-gradient(45deg, #aaa 25%, #fff 25%, #fff 75%, #aaa 75%, #aaa);
background-position: 0 0, 4px 4px;
background-size: 8px 8px;
}
.clr-marker:focus {
outline: none;
}
.clr-keyboard-nav .clr-marker:focus,
.clr-keyboard-nav .clr-hue input:focus + div,
.clr-keyboard-nav .clr-alpha input:focus + div,
.clr-keyboard-nav .clr-segmented input:focus + label {
outline: none;
box-shadow: 0 0 0 2px #1e90ff, 0 0 2px 2px #fff;
}
.clr-picker[data-alpha="false"] .clr-alpha {
display: none;
}
.clr-picker[data-minimal="true"] {
padding-top: 16px;
}
.clr-picker[data-minimal="true"] .clr-gradient,
.clr-picker[data-minimal="true"] .clr-hue,
.clr-picker[data-minimal="true"] .clr-alpha,
.clr-picker[data-minimal="true"] .clr-color,
.clr-picker[data-minimal="true"] .clr-preview {
display: none;
}
/** Dark theme **/
.clr-dark {
background-color: #444;
}
.clr-dark .clr-segmented {
border-color: #777;
}
.clr-dark .clr-swatches button:after {
box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}
.clr-dark input.clr-color {
color: #fff;
border-color: #777;
background-color: #555;
}
.clr-dark input.clr-color:focus {
border-color: #1e90ff;
}
.clr-dark .clr-preview:after {
box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.clr-dark .clr-alpha,
.clr-dark .clr-alpha div,
.clr-dark .clr-swatches button,
.clr-dark .clr-preview:before {
background-image: repeating-linear-gradient(45deg, #666 25%, transparent 25%, transparent 75%, #888 75%, #888), repeating-linear-gradient(45deg, #888 25%, #444 25%, #444 75%, #888 75%, #888);
}
/** Polaroid theme **/
.clr-picker.clr-polaroid {
border-radius: 6px;
box-shadow: 0 0 5px rgba(0,0,0,.1), 0 5px 30px rgba(0,0,0,.2);
}
.clr-picker.clr-polaroid:before {
content: '';
display: block;
position: absolute;
width: 16px;
height: 10px;
left: 20px;
top: -10px;
border: solid transparent;
border-width: 0 8px 10px 8px;
border-bottom-color: currentColor;
box-sizing: border-box;
color: #fff;
filter: drop-shadow(0 -4px 3px rgba(0,0,0,.1));
pointer-events: none;
}
.clr-picker.clr-polaroid.clr-dark:before {
color: #444;
}
.clr-picker.clr-polaroid.clr-left:before {
left: auto;
right: 20px;
}
.clr-picker.clr-polaroid.clr-top:before {
top: auto;
bottom: -10px;
transform: rotateZ(180deg);
}
.clr-polaroid .clr-gradient {
width: calc(100% - 20px);
height: 120px;
margin: 10px;
border-radius: 3px;
}
.clr-polaroid .clr-hue,
.clr-polaroid .clr-alpha {
width: calc(100% - 30px);
height: 10px;
margin: 6px 15px;
border-radius: 5px;
}
.clr-polaroid .clr-hue div,
.clr-polaroid .clr-alpha div {
box-shadow: 0 0 5px rgba(0,0,0,.2);
}
.clr-polaroid .clr-format {
width: calc(100% - 20px);
margin: 0 10px 15px;
}
.clr-polaroid .clr-swatches {
width: calc(100% - 12px);
margin: 0 6px;
}
.clr-polaroid .clr-swatches div {
padding-bottom: 10px;
}
.clr-polaroid .clr-swatches button {
width: 22px;
height: 22px;
}
.clr-polaroid input.clr-color {
width: calc(100% - 60px);
margin: 10px 10px 15px auto;
}
.clr-polaroid .clr-clear {
margin: 0 10px 15px 10px;
}
.clr-polaroid .clr-close {
margin: 0 10px 15px auto;
}
.clr-polaroid .clr-preview {
margin: 10px 0 15px 10px;
}
/** Large theme **/
.clr-picker.clr-large {
width: 275px;
}
.clr-large .clr-gradient {
height: 150px;
}
.clr-large .clr-swatches button {
width: 22px;
height: 22px;
}
/** Pill (horizontal) theme **/
.clr-picker.clr-pill {
width: 380px;
padding-left: 180px;
box-sizing: border-box;
}
.clr-pill .clr-gradient {
position: absolute;
width: 180px;
height: 100%;
left: 0;
top: 0;
margin-bottom: 0;
border-radius: 3px 0 0 3px;
}
.clr-pill .clr-hue {
margin-top: 20px;
}

View file

@ -0,0 +1,475 @@
/**
* Converts an input field to a color picker input.
*/
declare function Coloris(opts: Coloris.ColorisOptions): void;
declare global {
interface GlobalEventHandlersEventMap {
"coloris:pick": CustomEvent<Coloris.PickEventData>;
}
}
declare namespace Coloris {
/**
* All color themes supported by the color picker. More themes might be added
* in the future.
*/
type Theme =
| "default"
| "large"
| "polaroid"
| "pill";
/**
* All theme modes.
*/
type ThemeMode =
| "light"
| "dark"
| "auto";
/**
* Color format used by the color picker. The format affects which value is
* shown in the input field.
* - `hex` outputs `#RRGGBB` or `#RRGGBBAA`.
* - `rgb` outputs `rgb(R, G, B)` or `rgba(R, G, B, A)`.
* - `hsl` outputs `hsl(H, S, L)` or `hsla(H, S, L, A)`.
* - `auto` guesses the format from the active input field. Defaults to `hex` if
* it fails.
* - `mixed` outputs `#RRGGBB` when alpha is 1; otherwise `rgba(R, G, B, A)`.
*/
type ColorFormat =
| "hex"
| "rgb"
| "hsl"
| "auto"
| "mixed";
/**
* A function that is called whenever a new color is picked.
*
* @param color The newly selected color, as a CSS color string.
* @since 0.18.0
*/
type OnChangeCallback = (color: string) => void;
interface Accessibility {
/**
* @default "Open color picker"
*/
open: string;
/**
* @default "Close color picker"
*/
close: string;
/**
* @default "Clear the selected color"
*/
clear: string;
/**
* @default "Saturation: {s}. Brightness: {v}."
*/
marker: string;
/**
* @default "Hue slider"
*/
hueSlider: string;
/**
* @default "Opacity slider"
*/
alphaSlider: string;
/**
* @default "Color swatch"
*/
input: string;
/**
* @default "Color format"
*/
format: string;
/**
* @default "Color swatch"
*/
swatch: string;
/**
* @default "Saturation and brightness selector. Use up, down, left and right arrow keys to select."
*/
instruction: string;
}
/**
* Configuration for the optional clear button on the color picker.
* @deprecated Use the `clearLabel` setting to specify the label.
*/
interface ClearButtonOptions {
/**
* Whether the clear button is displayed when the color picker is opened.
*/
show: boolean;
/**
* The label text shown on the clear button.
*/
label: string;
}
/**
* Configuration for the optional close button on the color picker.
* @deprecated Use the `closeLabel` setting to specify the label.
*/
interface CloseButtonOptions {
/**
* Whether the close button is displayed when the color picker is opened.
*/
show: boolean;
/**
* The label text shown on the close button.
*/
label: string;
}
interface PickEventData {
/**
* The newly selected color which was picked.
*/
color: string;
}
/**
* Settings that can be configured for each color picker instance separately.
* @since 0.15.0
*/
interface ColorisVirtualInstanceOptions {
/**
* CSS selector for the parent.
*
* The default behavior is to append the color picker's dialog to the end of the document's
* body. but it is possible to append it to a custom parent instead. This is especially useful
* if the color fields are in a scrollable container and you want color picker' dialog to stay
* anchored to them. You will need to set the position of the container to relative or absolute.
* Note: This should be a scrollable container with enough space to display the picker.
*
* @default null
*/
parent?: null | string;
/**
* The color theme to use for the color picker. More themes might be added
* in the future. Available themes: default, large, polaroid.
*
* @default "default"
*/
theme?: Theme;
/**
* Set the theme to light or dark mode:
* - light: light mode.
* - dark: dark mode.
* - auto: automatically enables dark mode when the user prefers a dark color scheme.
*
* @default "light"
*/
themeMode?: ThemeMode,
/**
* The margin in pixels between the input fields and the color picker's
* dialog.
*
* @default 2
*/
margin?: number;
/**
* Sets the preferred color string format. The format affects which value is
* shown in the input field. See {@link ColorFormat} for more details.
*
* @default "hex"
*/
format?: ColorFormat;
/**
* Set to true to enable format toggle buttons in the color picker dialog.
*
* This will also force the format to auto.
*
* @default true
*/
formatToggle?: boolean;
/**
* Focus the color value input when the color picker dialog is opened.
*
* @default true
*/
focusInput?: boolean;
/**
* Select and focus the color value input when the color picker dialog is opened.
*
* @default false
*/
selectInput?: boolean;
/**
* Set to true to hide all the color picker widgets (spectrum, hue, ...) except the swatches.
*
* @default false
*/
swatchesOnly?: boolean;
/**
* Enable or disable alpha support.
*
* When disabled, it will strip the alpha value from the existing color
* value in all formats.
*
* @default true
*/
alpha?: boolean;
/**
* Set to true to always include the alpha value in the color value even if the opacity is 100%.
*
* @default false
*/
forceAlpha?: boolean,
/**
* Whether to show an optional clear button. Use `clearLabel` to set the label.
*
* Note that this should be a boolean, a `ClearButtonOptions` object is still
* supported for backwards compatibility, but it is deprecated.
*
* @default false
*/
clearButton?: boolean | ClearButtonOptions;
/**
* Set the label of the clear button.
* @default Clear
* @since 0.17.0
*/
clearLabel?: string,
/**
* Whether to show an optional close button. Use `closeLabel` to set the label.
*
* Note that this should be a boolean, a `CloseButtonOptions` object is still
* supported for backwards compatibility, but it is deprecated.
*
* @default false
*/
closeButton?: boolean | CloseButtonOptions;
/**
* Set the label of the close button.
*
* @default Close
* @since 0.17.0
*/
closeLabel?: string;
/**
* An array of the desired color swatches to display. If omitted or the
* array is empty, the color swatches will be disabled.
*
* @default []
*/
swatches?: string[];
/**
* A function that is called whenever a new color is picked.
* @since 0.18.0
*/
onChange?: OnChangeCallback;
}
interface ColorisOptions extends ColorisVirtualInstanceOptions {
/**
* Accessibility messages for various aria attribute etc.
*/
a11y?: Accessibility;
/**
* In inline mode, this is the default color that is set when the picker is initialized.
*/
defaultColor?: string;
/**
* A custom CSS selector to bind the color picker to. This must point to
* one or more {@link HTMLInputElement}s.
*/
el: string;
/**
* Set to `true` to use the color picker as an inline widget. In this mode the color picker is
* always visible and positioned statically within its container, which is by default the body
* of the document. Use the "parent" option to set a custom container.
*
* Note: In this mode, the best way to get the picked color is by listening to the `coloris:pick`
* event and reading the value from the event detail (see the example below). The other way is
* to read the value of the input field with the ID `clr-color-value`.
*
* @example
* ```js
* document.addEventListener("coloris:pick", event => {
* console.log("New color", event.detail.color);
* });
* ```
*/
inline?: boolean;
/**
* Set to true to activate basic right-to-left support.
*
* @default false
*/
rtl?: boolean;
/**
* The bound input fields are wrapped in a div that adds a thumbnail
* showing the current color and a button to open the color picker (for
* accessibility only).
*
* If you wish to keep your fields unaltered, set this to `false`, in which
* case you will lose the color thumbnail and the accessible button (not
* recommended).
*
* @default true
*/
wrap?: boolean;
}
/**
* The color picker dialog can be closed by clicking anywhere on the
* page or by pressing the ESC on the keyboard. The later will also
* revert the color to its original value.
*
* If you would like to close the dialog programmatically, you can do so
* by calling this method.
*
* @param {boolean} revert When `true`, resets the color to its original
* value. Defaults to `false`.
*/
function close(revert?: boolean): void;
/**
* Update the color picker's position and the color gradient's offset.
*/
function updatePosition(): void;
/**
* Converts an input field to a color picker input.
*/
function coloris(opts: ColorisOptions): void;
/**
* Adds a virtual instance with separate options.
*
* Although there is only one physical instance of the color picker in the document, it is possible
* to simulate multiple instances, each with its own appearance and behavior, by updating the
* configuration at runtime, when the color picker is opened.
*
* Here is an example of how to do it by manually setting configuration options in response to click events:
*
* ```js
* // Regular color fields use the default light theme
* document.querySelectorAll('.color-fields').forEach(input => {
* input.addEventListener('click', e => {
* Coloris({
* theme: 'default',
* themeMode: 'light',
* });
* });
* });
*
* // But the special color fields use the polaroid dark theme
* document.querySelectorAll('.special-color-fields').forEach(input => {
* input.addEventListener('click', e => {
* Coloris({
* theme: 'polaroid',
* themeMode: 'dark',
* });
* });
* });
* ```
*
* This works well and is quite versatile, but it can get a little hard to keep track of each
* change every "instance" makes and revert them to the default values.
*
* So as of version 0.15.0, there is a new way to automatically manage virtual instances. This works
* by assigning configuration overrides to a CSS selector representing one or more color fields.
*
* @example
* ```js
* // Color fields that have the class "instance1" have a format toggle,
* // no alpha slider, a dark theme and custom swatches
* Coloris.setInstance('.instance1', {
* theme: 'polaroid',
* themeMode: 'dark',
* alpha: false,
* formatToggle: true,
* swatches: [
* '#264653',
* '#2a9d8f',
* '#e9c46a'
* ]
* });
*
* // Fields matching the class "instance2" show color swatches only
* Coloris.setInstance('.instance2', {
* swatchesOnly: true,
* swatches: [
* '#264653',
* '#2a9d8f',
* '#e9c46a'
* ]
* });
* ```
* @param selector CSS selector for the input fields to which the options should apply.
* @param opts Options to apply to all color picker input fields matching the given selector.
* @since 0.15.0
*/
function setInstance(selector: string, opts: Partial<ColorisVirtualInstanceOptions>): void;
/**
* Removes a virtual instance that was added by {@link setInstance}. Note that
* to remove an instance, the selector must be exactly equal to what was passed
* to `setInstance`, it cannot merely be a different selector that happens to
* match the same elements.
* @param selector CSS selector to remove from the set of virtual instances.
*/
function removeInstance(selector: string): void;
/**
* Initializes the Coloris color picker and binds the color picker to all
* input fields with the `data-coloris` attribute.
*
* When the script file is loaded directly in a browser, this method is
* called automatically. When called in a module environment (e.g.
* browserify, rollup, or webpack), you need to call this method once before
* any other calls to any {@link Coloris} methods. This method checks for
* when the document is ready, so you do not have to call this method inside
* some document ready block.
*/
function init(): void;
}
export as namespace Coloris;
/**
* The main entry point or namespace for Coloris. This object is callable and
* can be used to initialize Coloris. It also contains several utility
* methods.
*/
export = Coloris;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
{
"type": "module"
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

View file

@ -134,6 +134,8 @@ export interface API {
set: (input: number | string | (number | string)[], fireSetEvent?: boolean, exactInput?: boolean) => void;
setHandle: (handleNumber: number, value: number | string, fireSetEvent?: boolean, exactInput?: boolean) => void;
reset: (fireSetEvent?: boolean) => void;
disable: (handleNumber?: number) => void;
enable: (handleNumber?: number) => void;
options: Options;
updateOptions: (optionsToUpdate: UpdatableOptions, fireSetEvent: boolean) => void;
target: HTMLElement;

View file

@ -959,6 +959,7 @@
else if (handleNumber === options.handles - 1) {
addClass(handle, options.cssClasses.handleUpper);
}
origin.handle = handle;
return origin;
}
// Insert nodes for connect elements
@ -1022,6 +1023,31 @@
var handleOrigin = scope_Handles[handleNumber];
return handleOrigin.hasAttribute("disabled");
}
function disable(handleNumber) {
if (handleNumber !== null && handleNumber !== undefined) {
scope_Handles[handleNumber].setAttribute("disabled", "");
scope_Handles[handleNumber].handle.removeAttribute("tabindex");
}
else {
scope_Target.setAttribute("disabled", "");
scope_Handles.forEach(function (handle) {
handle.handle.removeAttribute("tabindex");
});
}
}
function enable(handleNumber) {
if (handleNumber !== null && handleNumber !== undefined) {
scope_Handles[handleNumber].removeAttribute("disabled");
scope_Handles[handleNumber].handle.setAttribute("tabindex", "0");
}
else {
scope_Target.removeAttribute("disabled");
scope_Handles.forEach(function (handle) {
handle.removeAttribute("disabled");
handle.handle.setAttribute("tabindex", "0");
});
}
}
function removeTooltips() {
if (scope_Tooltips) {
removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
@ -2199,6 +2225,8 @@
set: valueSet,
setHandle: valueSetHandle,
reset: valueReset,
disable: disable,
enable: enable,
// Exposed for unit testing, don't use this in your application.
__moveHandles: function (upward, proposal, handleNumbers) {
moveHandles(upward, proposal, scope_Locations, handleNumbers);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -954,6 +954,7 @@ function scope(target, options, originalOptions) {
else if (handleNumber === options.handles - 1) {
addClass(handle, options.cssClasses.handleUpper);
}
origin.handle = handle;
return origin;
}
// Insert nodes for connect elements
@ -1017,6 +1018,31 @@ function scope(target, options, originalOptions) {
var handleOrigin = scope_Handles[handleNumber];
return handleOrigin.hasAttribute("disabled");
}
function disable(handleNumber) {
if (handleNumber !== null && handleNumber !== undefined) {
scope_Handles[handleNumber].setAttribute("disabled", "");
scope_Handles[handleNumber].handle.removeAttribute("tabindex");
}
else {
scope_Target.setAttribute("disabled", "");
scope_Handles.forEach(function (handle) {
handle.handle.removeAttribute("tabindex");
});
}
}
function enable(handleNumber) {
if (handleNumber !== null && handleNumber !== undefined) {
scope_Handles[handleNumber].removeAttribute("disabled");
scope_Handles[handleNumber].handle.setAttribute("tabindex", "0");
}
else {
scope_Target.removeAttribute("disabled");
scope_Handles.forEach(function (handle) {
handle.removeAttribute("disabled");
handle.handle.setAttribute("tabindex", "0");
});
}
}
function removeTooltips() {
if (scope_Tooltips) {
removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
@ -2194,6 +2220,8 @@ function scope(target, options, originalOptions) {
set: valueSet,
setHandle: valueSetHandle,
reset: valueReset,
disable: disable,
enable: enable,
// Exposed for unit testing, don't use this in your application.
__moveHandles: function (upward, proposal, handleNumbers) {
moveHandles(upward, proposal, scope_Locations, handleNumbers);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,481 @@
'use strict';
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var defaults = {
classNames: {
active: 'gl-active',
base: 'gl-star-rating',
selected: 'gl-selected'
},
clearable: true,
maxStars: 10,
prebuilt: false,
stars: null,
tooltip: 'Select a Rating'
};
var addRemoveClass = function addRemoveClass(el, bool, className) {
el.classList[bool ? 'add' : 'remove'](className);
};
var createSpanEl = function createSpanEl(attributes) {
var el = document.createElement('span');
attributes = attributes || {};
for (var key in attributes) {
el.setAttribute(key, attributes[key]);
}
return el;
};
var inRange = function inRange(value, min, max) {
return /^\d+$/.test(value) && min <= value && value <= max;
};
var insertSpanEl = function insertSpanEl(el, after, attributes) {
var newEl = createSpanEl(attributes);
el.parentNode.insertBefore(newEl, after ? el.nextSibling : el);
return newEl;
};
var merge = function merge() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// adapted from https://github.com/firstandthird/aug
var results = {};
args.forEach(function (prop) {
Object.keys(prop || {}).forEach(function (propName) {
if (args[0][propName] === undefined) return; // restrict keys to the defaults
var propValue = prop[propName];
if (type(propValue) === 'Object' && type(results[propName]) === 'Object') {
results[propName] = merge(results[propName], propValue);
return;
}
results[propName] = propValue;
});
});
return results;
};
var type = function type(value) {
return {}.toString.call(value).slice(8, -1);
};
var values = function values(selectEl) {
var values = [];
[].forEach.call(selectEl.options, function (el) {
var value = parseInt(el.value, 10) || 0;
if (value > 0) {
values.push({
index: el.index,
text: el.text,
value: value
});
}
});
return values.sort(function (a, b) {
return a.value - b.value;
});
};
var Widget = /*#__PURE__*/function () {
function Widget(el, props) {
_classCallCheck(this, Widget);
// (HTMLElement, object):void
this.direction = window.getComputedStyle(el, null).getPropertyValue('direction');
this.el = el;
this.events = {
change: this.onChange.bind(this),
keydown: this.onKeyDown.bind(this),
mousedown: this.onPointerDown.bind(this),
mouseleave: this.onPointerLeave.bind(this),
mousemove: this.onPointerMove.bind(this),
reset: this.onReset.bind(this),
touchend: this.onPointerDown.bind(this),
touchmove: this.onPointerMove.bind(this)
};
this.indexActive = null; // the active span index
this.indexSelected = null; // the selected span index
this.props = props;
this.tick = null;
this.ticking = false;
this.values = values(el);
this.widgetEl = null;
if (this.el.widget) {
this.el.widget.destroy(); // remove any stale event listeners
}
if (inRange(this.values.length, 1, this.props.maxStars)) {
this.build();
} else {
this.destroy();
}
}
_createClass(Widget, [{
key: "build",
value: function build() {
// ():void
this.destroy();
this.buildWidget();
this.selectValue(this.indexSelected = this.selected(), false); // set the initial value but do not trigger change event
this.handleEvents('add');
this.el.widget = this; // store a reference to this widget on the SELECT so that we can remove stale event listeners
}
}, {
key: "buildWidget",
value: function buildWidget() {
var _this = this;
// ():void
var parentEl, widgetEl;
if (this.props.prebuilt) {
parentEl = this.el.parentNode;
widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
} else {
parentEl = insertSpanEl(this.el, false, {
"class": this.props.classNames.base
});
parentEl.appendChild(this.el);
widgetEl = insertSpanEl(this.el, true, {
"class": this.props.classNames.base + '--stars'
});
this.values.forEach(function (item, index) {
var el = createSpanEl({
'data-index': index,
'data-value': item.value
});
if ('function' === typeof _this.props.stars) {
_this.props.stars.call(_this, el, item, index);
}
[].forEach.call(el.children, function (el) {
return el.style.pointerEvents = 'none';
});
widgetEl.innerHTML += el.outerHTML;
});
}
parentEl.dataset.starRating = '';
parentEl.classList.add(this.props.classNames.base + '--' + this.direction);
if (this.props.tooltip) {
widgetEl.setAttribute('role', 'tooltip');
}
this.widgetEl = widgetEl;
}
}, {
key: "changeIndexTo",
value: function changeIndexTo(index, force) {
var _this2 = this;
// (int):void
if (this.indexActive !== index || force) {
[].forEach.call(this.widgetEl.children, function (el, i) {
// i starts at zero
addRemoveClass(el, i <= index, _this2.props.classNames.active);
addRemoveClass(el, i === _this2.indexSelected, _this2.props.classNames.selected);
});
this.widgetEl.setAttribute('data-rating', index + 1);
if ('function' !== typeof this.props.stars && !this.props.prebuilt) {
// @v3 compat
this.widgetEl.classList.remove('s' + 10 * (this.indexActive + 1));
this.widgetEl.classList.add('s' + 10 * (index + 1));
}
if (this.props.tooltip) {
var _this$values$index;
var label = index < 0 ? this.props.tooltip : (_this$values$index = this.values[index]) === null || _this$values$index === void 0 ? void 0 : _this$values$index.text;
this.widgetEl.setAttribute('aria-label', label);
}
this.indexActive = index;
}
this.ticking = false;
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.indexActive = null; // the active span index
this.indexSelected = this.selected(); // the selected span index
var parentEl = this.el.parentNode;
if (parentEl.classList.contains(this.props.classNames.base)) {
if (this.props.prebuilt) {
this.widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
parentEl.classList.remove(this.props.classNames.base + '--' + this.direction);
delete parentEl.dataset.starRating;
} else {
parentEl.parentNode.replaceChild(this.el, parentEl);
}
this.handleEvents('remove');
}
delete this.el.widget; // remove the widget reference
}
}, {
key: "eventListener",
value: function eventListener(el, action, events, items) {
var _this3 = this;
// (HTMLElement, string, array, object):void
events.forEach(function (ev) {
return el[action + 'EventListener'](ev, _this3.events[ev], items || false);
});
}
}, {
key: "handleEvents",
value: function handleEvents(action) {
// (string):void
var formEl = this.el.closest('form');
if (formEl && formEl.tagName === 'FORM') {
this.eventListener(formEl, action, ['reset']);
}
this.eventListener(this.el, action, ['change']); // always trigger the change event, even when SELECT is disabled
if ('add' === action && this.el.disabled) return;
this.eventListener(this.el, action, ['keydown']);
this.eventListener(this.widgetEl, action, ['mousedown', 'mouseleave', 'mousemove', 'touchend', 'touchmove'], false);
}
}, {
key: "indexFromEvent",
value: function indexFromEvent(ev) {
var _ev$touches, _ev$changedTouches;
// (MouseEvent|TouchEvent):void
var origin = ((_ev$touches = ev.touches) === null || _ev$touches === void 0 ? void 0 : _ev$touches[0]) || ((_ev$changedTouches = ev.changedTouches) === null || _ev$changedTouches === void 0 ? void 0 : _ev$changedTouches[0]) || ev;
var el = document.elementFromPoint(origin.clientX, origin.clientY);
if (el.parentNode === this.widgetEl) {
return [].slice.call(el.parentNode.children).indexOf(el);
}
return this.indexActive;
}
}, {
key: "onChange",
value: function onChange() {
// ():void
this.changeIndexTo(this.selected(), true);
}
}, {
key: "onKeyDown",
value: function onKeyDown(ev) {
// (KeyboardEvent):void
var key = ev.key.slice(5);
if (!~['Left', 'Right'].indexOf(key)) return;
ev.preventDefault();
var increment = key === 'Left' ? -1 : 1;
if (this.direction === 'rtl') {
increment *= -1;
}
var maxIndex = this.values.length - 1;
var minIndex = -1;
var index = Math.min(Math.max(this.selected() + increment, minIndex), maxIndex);
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerDown",
value: function onPointerDown(ev) {
// (MouseEvent|TouchEvent):void
ev.preventDefault(); // this.el.focus(); // highlight the rating field
var index = this.indexFromEvent(ev);
if (this.props.clearable && index === this.indexSelected) {
index = -1; // remove the value
}
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerLeave",
value: function onPointerLeave(ev) {
var _this4 = this;
// (MouseEvent):void
ev.preventDefault();
cancelAnimationFrame(this.tick);
requestAnimationFrame(function () {
return _this4.changeIndexTo(_this4.indexSelected);
});
}
}, {
key: "onPointerMove",
value: function onPointerMove(ev) {
var _this5 = this;
// (MouseEvent|TouchEvent):void
ev.preventDefault();
if (!this.ticking) {
this.tick = requestAnimationFrame(function () {
return _this5.changeIndexTo(_this5.indexFromEvent(ev));
});
this.ticking = true;
}
}
}, {
key: "onReset",
value: function onReset() {
var _this$el$querySelecto;
// ():void
var index = this.valueIndex((_this$el$querySelecto = this.el.querySelector('[selected]')) === null || _this$el$querySelecto === void 0 ? void 0 : _this$el$querySelecto.value);
this.selectValue(index || -1, false); // do not trigger change event
}
}, {
key: "selected",
value: function selected() {
// ():int
return this.valueIndex(this.el.value); // get the selected span index
}
}, {
key: "selectValue",
value: function selectValue(index, triggerChangeEvent) {
var _this$values$index2;
// (int, bool):void
this.el.value = ((_this$values$index2 = this.values[index]) === null || _this$values$index2 === void 0 ? void 0 : _this$values$index2.value) || ''; // first set the new value
this.indexSelected = this.selected(); // get the actual index from the selected value
if (false === triggerChangeEvent) {
this.changeIndexTo(this.selected(), true);
} else {
this.el.dispatchEvent(new Event('change'));
}
}
}, {
key: "valueIndex",
value: function valueIndex(value) {
return this.values.findIndex(function (val) {
return val.value === +value;
});
}
}]);
return Widget;
}();
var StarRating = /*#__PURE__*/function () {
function StarRating(selector, props) {
_classCallCheck(this, StarRating);
// (HTMLSelectElement|NodeList|string, object):void
this.destroy = this.destroy.bind(this);
this.props = props;
this.rebuild = this.rebuild.bind(this);
this.selector = selector;
this.widgets = [];
this.build();
}
_createClass(StarRating, [{
key: "build",
value: function build() {
var _this = this;
// (HTMLSelectElement|NodeList|string, object):void
this.queryElements(this.selector).forEach(function (el) {
var options = merge(defaults, _this.props, JSON.parse(el.getAttribute('data-options')));
if ('SELECT' === el.tagName && !el.widget) {
// check for an existing Widget reference
if (!options.prebuilt && el.parentNode.classList.contains(options.classNames.base)) {
_this.unwrap(el);
}
_this.widgets.push(new Widget(el, options));
}
});
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.widgets.forEach(function (widget) {
return widget.destroy();
});
this.widgets = [];
}
}, {
key: "queryElements",
value: function queryElements(selector) {
// (HTMLSelectElement|NodeList|string):array
if ('HTMLSelectElement' === type(selector)) {
return [selector];
}
if ('NodeList' === type(selector)) {
return [].slice.call(selector);
}
if ('String' === type(selector)) {
return [].slice.call(document.querySelectorAll(selector));
}
return [];
}
}, {
key: "rebuild",
value: function rebuild() {
// ():void
this.destroy();
this.build();
}
}, {
key: "unwrap",
value: function unwrap(el) {
var removeEl = el.parentNode;
var parentEl = removeEl.parentNode;
parentEl.insertBefore(el, removeEl);
parentEl.removeChild(removeEl);
}
}]);
return StarRating;
}();
module.exports = StarRating;

View file

@ -0,0 +1,220 @@
:root {
--gl-star-color: #fdd835;
--gl-star-color-inactive: #dcdce6;
--gl-star-empty: url('../img/star-empty.svg');
--gl-star-full: url('../img/star-full.svg');
--gl-star-size: 24px;
--gl-tooltip-border-radius: 4px;
--gl-tooltip-font-size: 0.875rem;
--gl-tooltip-font-weight: 400;
--gl-tooltip-line-height: 1;
--gl-tooltip-margin: 12px;
--gl-tooltip-padding: .5em 1em;
--gl-tooltip-size: 6px;
}
[data-star-rating] > select {
-webkit-clip-path: circle(1px at 0 0) !important;
clip-path: circle(1px at 0 0) !important;
clip: rect(1px, 1px, 1px, 1px) !important;
height: 1px !important;
margin: 0 !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
top: 0 !important;
visibility: visible !important;
white-space: nowrap !important;
width: 1px !important;
}
[data-star-rating] > select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
pointer-events: none;
}
[data-star-rating] > select::before,
[data-star-rating] > select::after {
display: none !important;
}
[data-star-rating].gl-star-rating--ltr > select {
left: 0 !important;
}
[data-star-rating].gl-star-rating--rtl > select {
right: 0 !important;
}
[data-star-rating] {
align-items: center;
display: flex;
position: relative;
}
.gl-star-rating:not([data-star-rating]) .gl-star-rating--stars {
display: none;
}
[data-star-rating] .gl-star-rating--stars {
align-items: center;
cursor: pointer;
display: flex;
position: relative;
}
[data-star-rating] > select:focus + .gl-star-rating--stars span:first-child::before {
box-shadow: 0 0 0 3px -moz-mac-focusring;
box-shadow: 0 0 0 3px -webkit-focus-ring-color;
box-shadow: 0 0 0 3px Highlight;
content: '';
display: block;
height: 100%;
outline: 1px solid transparent;
pointer-events: none;
position: absolute;
width: 100%;
}
[data-star-rating] select[disabled] + .gl-star-rating--stars {
cursor: default;
}
[data-star-rating] .gl-star-rating--stars > span {
display: flex;
height: 24px;
height: 24px;
height: var(--gl-star-size);
margin: 0;
width: 24px;
width: 24px;
width: var(--gl-star-size);
}
[data-star-rating] .gl-star-rating--stars[aria-label]::before,
[data-star-rating] .gl-star-rating--stars[aria-label]::after {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
bottom: auto;
box-sizing: border-box;
left: 100%;
pointer-events: none;
position: absolute;
top: 50%;
opacity: .9;
transform-origin: top;
transform: translate3d(0,-50%,0);
white-space: nowrap;
z-index: 10;
}
[data-star-rating] .gl-star-rating--stars[aria-label]::before {
background-size: 100% auto !important;
background-position: 50% !important;
}
[data-star-rating] .gl-star-rating--stars[aria-label]::before {
background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 31"%3E%3Cpath fill="%23111" d="M12.002 31C12.002 25 0 19.838 0 15.5 0 11.24 12 6 12 0l.002 31z"/%3E%3C/svg%3E') no-repeat;
content: '';
height: 18px;
margin-bottom: 0;
margin-left: 6px;
margin-left: 6px;
margin-left: var(--gl-tooltip-size);
width: 6px;
width: 6px;
width: var(--gl-tooltip-size);
}
[data-star-rating] .gl-star-rating--stars[aria-label]::after {
background: #111;
border-radius: 4px;
border-radius: 4px;
border-radius: var(--gl-tooltip-border-radius);
color: #fff;
content: attr(aria-label);
font-size: 0.875rem;
font-size: 0.875rem;
font-size: var(--gl-tooltip-font-size);
font-weight: normal;
margin-left: 12px;
margin-left: 12px;
margin-left: var(--gl-tooltip-margin);
padding: .5em 1em;
padding: .5em 1em;
padding: var(--gl-tooltip-padding);
text-transform: none;
}
[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]::before,
[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]::after {
left: auto;
right: 100%;
}
[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]::before {
transform: scaleX(-1) translate3d(0,-50%,0);
margin-left: 0;
margin-right: 6px;
margin-right: 6px;
margin-right: var(--gl-tooltip-size);
}
[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]::after {
margin-left: 0;
margin-right: 12px;
margin-right: 12px;
margin-right: var(--gl-tooltip-margin);
}
[data-star-rating] svg {
height: 100%;
width: 100%;
}
[data-star-rating] .gl-star-half {
fill: none;
stroke: none;
}
[data-star-rating] .gl-star-full {
fill: #dcdce6;
fill: #dcdce6;
fill: var(--gl-star-color-inactive);
stroke: #dcdce6;
stroke: #dcdce6;
stroke: var(--gl-star-color-inactive);
transition: fill 0.15s ease-in-out, stroke 0.15s ease-in-out;
}
[data-star-rating] .gl-active .gl-star-full {
fill: #fdd835;
fill: #fdd835;
fill: var(--gl-star-color);
stroke: #fdd835;
stroke: #fdd835;
stroke: var(--gl-star-color);
}
/* Compatibilty with v3 */
.gl-star-rating--stars[class*=" s"] > span {
background-image: url('../img/star-empty.svg') !important;
background-image: url('../img/star-empty.svg') !important;
background-image: var(--gl-star-empty) !important;
}
.gl-star-rating--stars[class*=" s"] > span {
background-position: center;
background-repeat: no-repeat;
background-size: 90%;
}
.gl-star-rating--stars[class*=" s"] > span.gl-active,
.gl-star-rating--stars[class*=" s"] > span.gl-active.gl-selected {
background-image: url('../img/star-full.svg') !important;
background-image: url('../img/star-full.svg') !important;
background-image: var(--gl-star-full) !important;
}

View file

@ -0,0 +1,479 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var defaults = {
classNames: {
active: 'gl-active',
base: 'gl-star-rating',
selected: 'gl-selected'
},
clearable: true,
maxStars: 10,
prebuilt: false,
stars: null,
tooltip: 'Select a Rating'
};
var addRemoveClass = function addRemoveClass(el, bool, className) {
el.classList[bool ? 'add' : 'remove'](className);
};
var createSpanEl = function createSpanEl(attributes) {
var el = document.createElement('span');
attributes = attributes || {};
for (var key in attributes) {
el.setAttribute(key, attributes[key]);
}
return el;
};
var inRange = function inRange(value, min, max) {
return /^\d+$/.test(value) && min <= value && value <= max;
};
var insertSpanEl = function insertSpanEl(el, after, attributes) {
var newEl = createSpanEl(attributes);
el.parentNode.insertBefore(newEl, after ? el.nextSibling : el);
return newEl;
};
var merge = function merge() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// adapted from https://github.com/firstandthird/aug
var results = {};
args.forEach(function (prop) {
Object.keys(prop || {}).forEach(function (propName) {
if (args[0][propName] === undefined) return; // restrict keys to the defaults
var propValue = prop[propName];
if (type(propValue) === 'Object' && type(results[propName]) === 'Object') {
results[propName] = merge(results[propName], propValue);
return;
}
results[propName] = propValue;
});
});
return results;
};
var type = function type(value) {
return {}.toString.call(value).slice(8, -1);
};
var values = function values(selectEl) {
var values = [];
[].forEach.call(selectEl.options, function (el) {
var value = parseInt(el.value, 10) || 0;
if (value > 0) {
values.push({
index: el.index,
text: el.text,
value: value
});
}
});
return values.sort(function (a, b) {
return a.value - b.value;
});
};
var Widget = /*#__PURE__*/function () {
function Widget(el, props) {
_classCallCheck(this, Widget);
// (HTMLElement, object):void
this.direction = window.getComputedStyle(el, null).getPropertyValue('direction');
this.el = el;
this.events = {
change: this.onChange.bind(this),
keydown: this.onKeyDown.bind(this),
mousedown: this.onPointerDown.bind(this),
mouseleave: this.onPointerLeave.bind(this),
mousemove: this.onPointerMove.bind(this),
reset: this.onReset.bind(this),
touchend: this.onPointerDown.bind(this),
touchmove: this.onPointerMove.bind(this)
};
this.indexActive = null; // the active span index
this.indexSelected = null; // the selected span index
this.props = props;
this.tick = null;
this.ticking = false;
this.values = values(el);
this.widgetEl = null;
if (this.el.widget) {
this.el.widget.destroy(); // remove any stale event listeners
}
if (inRange(this.values.length, 1, this.props.maxStars)) {
this.build();
} else {
this.destroy();
}
}
_createClass(Widget, [{
key: "build",
value: function build() {
// ():void
this.destroy();
this.buildWidget();
this.selectValue(this.indexSelected = this.selected(), false); // set the initial value but do not trigger change event
this.handleEvents('add');
this.el.widget = this; // store a reference to this widget on the SELECT so that we can remove stale event listeners
}
}, {
key: "buildWidget",
value: function buildWidget() {
var _this = this;
// ():void
var parentEl, widgetEl;
if (this.props.prebuilt) {
parentEl = this.el.parentNode;
widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
} else {
parentEl = insertSpanEl(this.el, false, {
"class": this.props.classNames.base
});
parentEl.appendChild(this.el);
widgetEl = insertSpanEl(this.el, true, {
"class": this.props.classNames.base + '--stars'
});
this.values.forEach(function (item, index) {
var el = createSpanEl({
'data-index': index,
'data-value': item.value
});
if ('function' === typeof _this.props.stars) {
_this.props.stars.call(_this, el, item, index);
}
[].forEach.call(el.children, function (el) {
return el.style.pointerEvents = 'none';
});
widgetEl.innerHTML += el.outerHTML;
});
}
parentEl.dataset.starRating = '';
parentEl.classList.add(this.props.classNames.base + '--' + this.direction);
if (this.props.tooltip) {
widgetEl.setAttribute('role', 'tooltip');
}
this.widgetEl = widgetEl;
}
}, {
key: "changeIndexTo",
value: function changeIndexTo(index, force) {
var _this2 = this;
// (int):void
if (this.indexActive !== index || force) {
[].forEach.call(this.widgetEl.children, function (el, i) {
// i starts at zero
addRemoveClass(el, i <= index, _this2.props.classNames.active);
addRemoveClass(el, i === _this2.indexSelected, _this2.props.classNames.selected);
});
this.widgetEl.setAttribute('data-rating', index + 1);
if ('function' !== typeof this.props.stars && !this.props.prebuilt) {
// @v3 compat
this.widgetEl.classList.remove('s' + 10 * (this.indexActive + 1));
this.widgetEl.classList.add('s' + 10 * (index + 1));
}
if (this.props.tooltip) {
var _this$values$index;
var label = index < 0 ? this.props.tooltip : (_this$values$index = this.values[index]) === null || _this$values$index === void 0 ? void 0 : _this$values$index.text;
this.widgetEl.setAttribute('aria-label', label);
}
this.indexActive = index;
}
this.ticking = false;
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.indexActive = null; // the active span index
this.indexSelected = this.selected(); // the selected span index
var parentEl = this.el.parentNode;
if (parentEl.classList.contains(this.props.classNames.base)) {
if (this.props.prebuilt) {
this.widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
parentEl.classList.remove(this.props.classNames.base + '--' + this.direction);
delete parentEl.dataset.starRating;
} else {
parentEl.parentNode.replaceChild(this.el, parentEl);
}
this.handleEvents('remove');
}
delete this.el.widget; // remove the widget reference
}
}, {
key: "eventListener",
value: function eventListener(el, action, events, items) {
var _this3 = this;
// (HTMLElement, string, array, object):void
events.forEach(function (ev) {
return el[action + 'EventListener'](ev, _this3.events[ev], items || false);
});
}
}, {
key: "handleEvents",
value: function handleEvents(action) {
// (string):void
var formEl = this.el.closest('form');
if (formEl && formEl.tagName === 'FORM') {
this.eventListener(formEl, action, ['reset']);
}
this.eventListener(this.el, action, ['change']); // always trigger the change event, even when SELECT is disabled
if ('add' === action && this.el.disabled) return;
this.eventListener(this.el, action, ['keydown']);
this.eventListener(this.widgetEl, action, ['mousedown', 'mouseleave', 'mousemove', 'touchend', 'touchmove'], false);
}
}, {
key: "indexFromEvent",
value: function indexFromEvent(ev) {
var _ev$touches, _ev$changedTouches;
// (MouseEvent|TouchEvent):void
var origin = ((_ev$touches = ev.touches) === null || _ev$touches === void 0 ? void 0 : _ev$touches[0]) || ((_ev$changedTouches = ev.changedTouches) === null || _ev$changedTouches === void 0 ? void 0 : _ev$changedTouches[0]) || ev;
var el = document.elementFromPoint(origin.clientX, origin.clientY);
if (el.parentNode === this.widgetEl) {
return [].slice.call(el.parentNode.children).indexOf(el);
}
return this.indexActive;
}
}, {
key: "onChange",
value: function onChange() {
// ():void
this.changeIndexTo(this.selected(), true);
}
}, {
key: "onKeyDown",
value: function onKeyDown(ev) {
// (KeyboardEvent):void
var key = ev.key.slice(5);
if (!~['Left', 'Right'].indexOf(key)) return;
ev.preventDefault();
var increment = key === 'Left' ? -1 : 1;
if (this.direction === 'rtl') {
increment *= -1;
}
var maxIndex = this.values.length - 1;
var minIndex = -1;
var index = Math.min(Math.max(this.selected() + increment, minIndex), maxIndex);
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerDown",
value: function onPointerDown(ev) {
// (MouseEvent|TouchEvent):void
ev.preventDefault(); // this.el.focus(); // highlight the rating field
var index = this.indexFromEvent(ev);
if (this.props.clearable && index === this.indexSelected) {
index = -1; // remove the value
}
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerLeave",
value: function onPointerLeave(ev) {
var _this4 = this;
// (MouseEvent):void
ev.preventDefault();
cancelAnimationFrame(this.tick);
requestAnimationFrame(function () {
return _this4.changeIndexTo(_this4.indexSelected);
});
}
}, {
key: "onPointerMove",
value: function onPointerMove(ev) {
var _this5 = this;
// (MouseEvent|TouchEvent):void
ev.preventDefault();
if (!this.ticking) {
this.tick = requestAnimationFrame(function () {
return _this5.changeIndexTo(_this5.indexFromEvent(ev));
});
this.ticking = true;
}
}
}, {
key: "onReset",
value: function onReset() {
var _this$el$querySelecto;
// ():void
var index = this.valueIndex((_this$el$querySelecto = this.el.querySelector('[selected]')) === null || _this$el$querySelecto === void 0 ? void 0 : _this$el$querySelecto.value);
this.selectValue(index || -1, false); // do not trigger change event
}
}, {
key: "selected",
value: function selected() {
// ():int
return this.valueIndex(this.el.value); // get the selected span index
}
}, {
key: "selectValue",
value: function selectValue(index, triggerChangeEvent) {
var _this$values$index2;
// (int, bool):void
this.el.value = ((_this$values$index2 = this.values[index]) === null || _this$values$index2 === void 0 ? void 0 : _this$values$index2.value) || ''; // first set the new value
this.indexSelected = this.selected(); // get the actual index from the selected value
if (false === triggerChangeEvent) {
this.changeIndexTo(this.selected(), true);
} else {
this.el.dispatchEvent(new Event('change'));
}
}
}, {
key: "valueIndex",
value: function valueIndex(value) {
return this.values.findIndex(function (val) {
return val.value === +value;
});
}
}]);
return Widget;
}();
var StarRating = /*#__PURE__*/function () {
function StarRating(selector, props) {
_classCallCheck(this, StarRating);
// (HTMLSelectElement|NodeList|string, object):void
this.destroy = this.destroy.bind(this);
this.props = props;
this.rebuild = this.rebuild.bind(this);
this.selector = selector;
this.widgets = [];
this.build();
}
_createClass(StarRating, [{
key: "build",
value: function build() {
var _this = this;
// (HTMLSelectElement|NodeList|string, object):void
this.queryElements(this.selector).forEach(function (el) {
var options = merge(defaults, _this.props, JSON.parse(el.getAttribute('data-options')));
if ('SELECT' === el.tagName && !el.widget) {
// check for an existing Widget reference
if (!options.prebuilt && el.parentNode.classList.contains(options.classNames.base)) {
_this.unwrap(el);
}
_this.widgets.push(new Widget(el, options));
}
});
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.widgets.forEach(function (widget) {
return widget.destroy();
});
this.widgets = [];
}
}, {
key: "queryElements",
value: function queryElements(selector) {
// (HTMLSelectElement|NodeList|string):array
if ('HTMLSelectElement' === type(selector)) {
return [selector];
}
if ('NodeList' === type(selector)) {
return [].slice.call(selector);
}
if ('String' === type(selector)) {
return [].slice.call(document.querySelectorAll(selector));
}
return [];
}
}, {
key: "rebuild",
value: function rebuild() {
// ():void
this.destroy();
this.build();
}
}, {
key: "unwrap",
value: function unwrap(el) {
var removeEl = el.parentNode;
var parentEl = removeEl.parentNode;
parentEl.insertBefore(el, removeEl);
parentEl.removeChild(removeEl);
}
}]);
return StarRating;
}();
export default StarRating;

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,491 @@
/**!
* Star Rating
* @version: 4.3.0
* @author: Paul Ryley (http://geminilabs.io)
* @url: https://github.com/pryley/star-rating.js
* @license: MIT
*/
var StarRating = (function () {
'use strict';
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var defaults = {
classNames: {
active: 'gl-active',
base: 'gl-star-rating',
selected: 'gl-selected'
},
clearable: true,
maxStars: 10,
prebuilt: false,
stars: null,
tooltip: 'Select a Rating'
};
var addRemoveClass = function addRemoveClass(el, bool, className) {
el.classList[bool ? 'add' : 'remove'](className);
};
var createSpanEl = function createSpanEl(attributes) {
var el = document.createElement('span');
attributes = attributes || {};
for (var key in attributes) {
el.setAttribute(key, attributes[key]);
}
return el;
};
var inRange = function inRange(value, min, max) {
return /^\d+$/.test(value) && min <= value && value <= max;
};
var insertSpanEl = function insertSpanEl(el, after, attributes) {
var newEl = createSpanEl(attributes);
el.parentNode.insertBefore(newEl, after ? el.nextSibling : el);
return newEl;
};
var merge = function merge() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// adapted from https://github.com/firstandthird/aug
var results = {};
args.forEach(function (prop) {
Object.keys(prop || {}).forEach(function (propName) {
if (args[0][propName] === undefined) return; // restrict keys to the defaults
var propValue = prop[propName];
if (type(propValue) === 'Object' && type(results[propName]) === 'Object') {
results[propName] = merge(results[propName], propValue);
return;
}
results[propName] = propValue;
});
});
return results;
};
var type = function type(value) {
return {}.toString.call(value).slice(8, -1);
};
var values = function values(selectEl) {
var values = [];
[].forEach.call(selectEl.options, function (el) {
var value = parseInt(el.value, 10) || 0;
if (value > 0) {
values.push({
index: el.index,
text: el.text,
value: value
});
}
});
return values.sort(function (a, b) {
return a.value - b.value;
});
};
var Widget = /*#__PURE__*/function () {
function Widget(el, props) {
_classCallCheck(this, Widget);
// (HTMLElement, object):void
this.direction = window.getComputedStyle(el, null).getPropertyValue('direction');
this.el = el;
this.events = {
change: this.onChange.bind(this),
keydown: this.onKeyDown.bind(this),
mousedown: this.onPointerDown.bind(this),
mouseleave: this.onPointerLeave.bind(this),
mousemove: this.onPointerMove.bind(this),
reset: this.onReset.bind(this),
touchend: this.onPointerDown.bind(this),
touchmove: this.onPointerMove.bind(this)
};
this.indexActive = null; // the active span index
this.indexSelected = null; // the selected span index
this.props = props;
this.tick = null;
this.ticking = false;
this.values = values(el);
this.widgetEl = null;
if (this.el.widget) {
this.el.widget.destroy(); // remove any stale event listeners
}
if (inRange(this.values.length, 1, this.props.maxStars)) {
this.build();
} else {
this.destroy();
}
}
_createClass(Widget, [{
key: "build",
value: function build() {
// ():void
this.destroy();
this.buildWidget();
this.selectValue(this.indexSelected = this.selected(), false); // set the initial value but do not trigger change event
this.handleEvents('add');
this.el.widget = this; // store a reference to this widget on the SELECT so that we can remove stale event listeners
}
}, {
key: "buildWidget",
value: function buildWidget() {
var _this = this;
// ():void
var parentEl, widgetEl;
if (this.props.prebuilt) {
parentEl = this.el.parentNode;
widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
} else {
parentEl = insertSpanEl(this.el, false, {
"class": this.props.classNames.base
});
parentEl.appendChild(this.el);
widgetEl = insertSpanEl(this.el, true, {
"class": this.props.classNames.base + '--stars'
});
this.values.forEach(function (item, index) {
var el = createSpanEl({
'data-index': index,
'data-value': item.value
});
if ('function' === typeof _this.props.stars) {
_this.props.stars.call(_this, el, item, index);
}
[].forEach.call(el.children, function (el) {
return el.style.pointerEvents = 'none';
});
widgetEl.innerHTML += el.outerHTML;
});
}
parentEl.dataset.starRating = '';
parentEl.classList.add(this.props.classNames.base + '--' + this.direction);
if (this.props.tooltip) {
widgetEl.setAttribute('role', 'tooltip');
}
this.widgetEl = widgetEl;
}
}, {
key: "changeIndexTo",
value: function changeIndexTo(index, force) {
var _this2 = this;
// (int):void
if (this.indexActive !== index || force) {
[].forEach.call(this.widgetEl.children, function (el, i) {
// i starts at zero
addRemoveClass(el, i <= index, _this2.props.classNames.active);
addRemoveClass(el, i === _this2.indexSelected, _this2.props.classNames.selected);
});
this.widgetEl.setAttribute('data-rating', index + 1);
if ('function' !== typeof this.props.stars && !this.props.prebuilt) {
// @v3 compat
this.widgetEl.classList.remove('s' + 10 * (this.indexActive + 1));
this.widgetEl.classList.add('s' + 10 * (index + 1));
}
if (this.props.tooltip) {
var _this$values$index;
var label = index < 0 ? this.props.tooltip : (_this$values$index = this.values[index]) === null || _this$values$index === void 0 ? void 0 : _this$values$index.text;
this.widgetEl.setAttribute('aria-label', label);
}
this.indexActive = index;
}
this.ticking = false;
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.indexActive = null; // the active span index
this.indexSelected = this.selected(); // the selected span index
var parentEl = this.el.parentNode;
if (parentEl.classList.contains(this.props.classNames.base)) {
if (this.props.prebuilt) {
this.widgetEl = parentEl.querySelector('.' + this.props.classNames.base + '--stars');
parentEl.classList.remove(this.props.classNames.base + '--' + this.direction);
delete parentEl.dataset.starRating;
} else {
parentEl.parentNode.replaceChild(this.el, parentEl);
}
this.handleEvents('remove');
}
delete this.el.widget; // remove the widget reference
}
}, {
key: "eventListener",
value: function eventListener(el, action, events, items) {
var _this3 = this;
// (HTMLElement, string, array, object):void
events.forEach(function (ev) {
return el[action + 'EventListener'](ev, _this3.events[ev], items || false);
});
}
}, {
key: "handleEvents",
value: function handleEvents(action) {
// (string):void
var formEl = this.el.closest('form');
if (formEl && formEl.tagName === 'FORM') {
this.eventListener(formEl, action, ['reset']);
}
this.eventListener(this.el, action, ['change']); // always trigger the change event, even when SELECT is disabled
if ('add' === action && this.el.disabled) return;
this.eventListener(this.el, action, ['keydown']);
this.eventListener(this.widgetEl, action, ['mousedown', 'mouseleave', 'mousemove', 'touchend', 'touchmove'], false);
}
}, {
key: "indexFromEvent",
value: function indexFromEvent(ev) {
var _ev$touches, _ev$changedTouches;
// (MouseEvent|TouchEvent):void
var origin = ((_ev$touches = ev.touches) === null || _ev$touches === void 0 ? void 0 : _ev$touches[0]) || ((_ev$changedTouches = ev.changedTouches) === null || _ev$changedTouches === void 0 ? void 0 : _ev$changedTouches[0]) || ev;
var el = document.elementFromPoint(origin.clientX, origin.clientY);
if (el.parentNode === this.widgetEl) {
return [].slice.call(el.parentNode.children).indexOf(el);
}
return this.indexActive;
}
}, {
key: "onChange",
value: function onChange() {
// ():void
this.changeIndexTo(this.selected(), true);
}
}, {
key: "onKeyDown",
value: function onKeyDown(ev) {
// (KeyboardEvent):void
var key = ev.key.slice(5);
if (!~['Left', 'Right'].indexOf(key)) return;
ev.preventDefault();
var increment = key === 'Left' ? -1 : 1;
if (this.direction === 'rtl') {
increment *= -1;
}
var maxIndex = this.values.length - 1;
var minIndex = -1;
var index = Math.min(Math.max(this.selected() + increment, minIndex), maxIndex);
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerDown",
value: function onPointerDown(ev) {
// (MouseEvent|TouchEvent):void
ev.preventDefault(); // this.el.focus(); // highlight the rating field
var index = this.indexFromEvent(ev);
if (this.props.clearable && index === this.indexSelected) {
index = -1; // remove the value
}
this.selectValue(index, true); // trigger change event
}
}, {
key: "onPointerLeave",
value: function onPointerLeave(ev) {
var _this4 = this;
// (MouseEvent):void
ev.preventDefault();
cancelAnimationFrame(this.tick);
requestAnimationFrame(function () {
return _this4.changeIndexTo(_this4.indexSelected);
});
}
}, {
key: "onPointerMove",
value: function onPointerMove(ev) {
var _this5 = this;
// (MouseEvent|TouchEvent):void
ev.preventDefault();
if (!this.ticking) {
this.tick = requestAnimationFrame(function () {
return _this5.changeIndexTo(_this5.indexFromEvent(ev));
});
this.ticking = true;
}
}
}, {
key: "onReset",
value: function onReset() {
var _this$el$querySelecto;
// ():void
var index = this.valueIndex((_this$el$querySelecto = this.el.querySelector('[selected]')) === null || _this$el$querySelecto === void 0 ? void 0 : _this$el$querySelecto.value);
this.selectValue(index || -1, false); // do not trigger change event
}
}, {
key: "selected",
value: function selected() {
// ():int
return this.valueIndex(this.el.value); // get the selected span index
}
}, {
key: "selectValue",
value: function selectValue(index, triggerChangeEvent) {
var _this$values$index2;
// (int, bool):void
this.el.value = ((_this$values$index2 = this.values[index]) === null || _this$values$index2 === void 0 ? void 0 : _this$values$index2.value) || ''; // first set the new value
this.indexSelected = this.selected(); // get the actual index from the selected value
if (false === triggerChangeEvent) {
this.changeIndexTo(this.selected(), true);
} else {
this.el.dispatchEvent(new Event('change'));
}
}
}, {
key: "valueIndex",
value: function valueIndex(value) {
return this.values.findIndex(function (val) {
return val.value === +value;
});
}
}]);
return Widget;
}();
var StarRating = /*#__PURE__*/function () {
function StarRating(selector, props) {
_classCallCheck(this, StarRating);
// (HTMLSelectElement|NodeList|string, object):void
this.destroy = this.destroy.bind(this);
this.props = props;
this.rebuild = this.rebuild.bind(this);
this.selector = selector;
this.widgets = [];
this.build();
}
_createClass(StarRating, [{
key: "build",
value: function build() {
var _this = this;
// (HTMLSelectElement|NodeList|string, object):void
this.queryElements(this.selector).forEach(function (el) {
var options = merge(defaults, _this.props, JSON.parse(el.getAttribute('data-options')));
if ('SELECT' === el.tagName && !el.widget) {
// check for an existing Widget reference
if (!options.prebuilt && el.parentNode.classList.contains(options.classNames.base)) {
_this.unwrap(el);
}
_this.widgets.push(new Widget(el, options));
}
});
}
}, {
key: "destroy",
value: function destroy() {
// ():void
this.widgets.forEach(function (widget) {
return widget.destroy();
});
this.widgets = [];
}
}, {
key: "queryElements",
value: function queryElements(selector) {
// (HTMLSelectElement|NodeList|string):array
if ('HTMLSelectElement' === type(selector)) {
return [selector];
}
if ('NodeList' === type(selector)) {
return [].slice.call(selector);
}
if ('String' === type(selector)) {
return [].slice.call(document.querySelectorAll(selector));
}
return [];
}
}, {
key: "rebuild",
value: function rebuild() {
// ():void
this.destroy();
this.build();
}
}, {
key: "unwrap",
value: function unwrap(el) {
var removeEl = el.parentNode;
var parentEl = removeEl.parentNode;
parentEl.insertBefore(el, removeEl);
parentEl.removeChild(removeEl);
}
}]);
return StarRating;
}();
return StarRating;
}());

View file

@ -0,0 +1,8 @@
/**
* Star Rating
* @version: 4.3.0
* @author: Paul Ryley (http://geminilabs.io)
* @url: https://github.com/pryley/star-rating.js
* @license: MIT
*/
:root{--gl-star-color:#fdd835;--gl-star-color-inactive:#dcdce6;--gl-star-empty:url(../img/star-empty.svg);--gl-star-full:url(../img/star-full.svg);--gl-star-size:24px;--gl-tooltip-border-radius:4px;--gl-tooltip-font-size:0.875rem;--gl-tooltip-font-weight:400;--gl-tooltip-line-height:1;--gl-tooltip-margin:12px;--gl-tooltip-padding:.5em 1em;--gl-tooltip-size:6px}[data-star-rating]>select{-webkit-clip-path:circle(1px at 0 0)!important;clip-path:circle(1px at 0 0)!important;clip:rect(1px,1px,1px,1px)!important;height:1px!important;margin:0!important;overflow:hidden!important;padding:0!important;position:absolute!important;top:0!important;visibility:visible!important;white-space:nowrap!important;width:1px!important;-webkit-appearance:none;-moz-appearance:none;appearance:none;pointer-events:none}[data-star-rating]>select:after,[data-star-rating]>select:before{display:none!important}[data-star-rating].gl-star-rating--ltr>select{left:0!important}[data-star-rating].gl-star-rating--rtl>select{right:0!important}[data-star-rating]{align-items:center;display:flex;position:relative}.gl-star-rating:not([data-star-rating]) .gl-star-rating--stars{display:none}[data-star-rating] .gl-star-rating--stars{align-items:center;cursor:pointer;display:flex;position:relative}[data-star-rating]>select:focus+.gl-star-rating--stars span:first-child:before{box-shadow:0 0 0 3px -moz-mac-focusring;box-shadow:0 0 0 3px -webkit-focus-ring-color;box-shadow:0 0 0 3px Highlight;content:"";display:block;height:100%;outline:1px solid transparent;pointer-events:none;position:absolute;width:100%}[data-star-rating] select[disabled]+.gl-star-rating--stars{cursor:default}[data-star-rating] .gl-star-rating--stars>span{display:flex;height:24px;height:var(--gl-star-size);margin:0;width:24px;width:var(--gl-star-size)}[data-star-rating] .gl-star-rating--stars[aria-label]:after,[data-star-rating] .gl-star-rating--stars[aria-label]:before{-webkit-backface-visibility:hidden;backface-visibility:hidden;bottom:auto;box-sizing:border-box;left:100%;pointer-events:none;position:absolute;top:50%;opacity:.9;transform-origin:top;transform:translate3d(0,-50%,0);white-space:nowrap;z-index:10}[data-star-rating] .gl-star-rating--stars[aria-label]:before{background-size:100% auto!important;background-position:50%!important;background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 31'%3E%3Cpath fill='%23111' d='M12.002 31C12.002 25 0 19.838 0 15.5 0 11.24 12 6 12 0l.002 31z'/%3E%3C/svg%3E") no-repeat;content:"";height:18px;margin-bottom:0;margin-left:6px;margin-left:var(--gl-tooltip-size);width:6px;width:var(--gl-tooltip-size)}[data-star-rating] .gl-star-rating--stars[aria-label]:after{background:#111;border-radius:4px;border-radius:var(--gl-tooltip-border-radius);color:#fff;content:attr(aria-label);font-size:.875rem;font-size:var(--gl-tooltip-font-size);font-weight:400;margin-left:12px;margin-left:var(--gl-tooltip-margin);padding:.5em 1em;padding:var(--gl-tooltip-padding);text-transform:none}[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]:after,[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]:before{left:auto;right:100%}[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]:before{transform:scaleX(-1) translate3d(0,-50%,0);margin-left:0;margin-right:6px;margin-right:var(--gl-tooltip-size)}[data-star-rating].gl-star-rating--rtl .gl-star-rating--stars[aria-label]:after{margin-left:0;margin-right:12px;margin-right:var(--gl-tooltip-margin)}[data-star-rating] svg{height:100%;width:100%}[data-star-rating] .gl-star-half{fill:none;stroke:none}[data-star-rating] .gl-star-full{fill:#dcdce6;fill:var(--gl-star-color-inactive);stroke:#dcdce6;stroke:var(--gl-star-color-inactive);transition:fill .15s ease-in-out,stroke .15s ease-in-out}[data-star-rating] .gl-active .gl-star-full{fill:#fdd835;fill:var(--gl-star-color);stroke:#fdd835;stroke:var(--gl-star-color)}.gl-star-rating--stars[class*=" s"]>span{background-image:url(../img/star-empty.svg)!important;background-image:var(--gl-star-empty)!important;background-position:50%;background-repeat:no-repeat;background-size:90%}.gl-star-rating--stars[class*=" s"]>span.gl-active,.gl-star-rating--stars[class*=" s"]>span.gl-active.gl-selected{background-image:url(../img/star-full.svg)!important;background-image:var(--gl-star-full)!important}

File diff suppressed because one or more lines are too long

View file

@ -6,6 +6,167 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## 6.4.2 - 2023-04-26
### Fixed
- The editor would display a notification error when it fails to retirieve a blob image uri. #TINY-9604
- Menu buttons would have the Tabstopping behaviour in toolbar. #TINY-9723
- The `urlinput` dialog component would not open the typeahead dropdown when the input value was reset to an empty string. #TINY-9717
- Redial would in some situations cause select elements not to have an initial value selected when they should have. #TINY-9679
- Fixed the mouse pointer style from a text cursor to a default arrow pointer when hovering over the tree dialog component items. #TINY-9692
- Enabled variant of togglable `tox-button` and `tox-button--secondary` now supports `hover`/`active`/`focus`/`disabled` states. #TINY-9713
- Setting an invalid unit in the `fontsizeinput` would change it do the default value instead of reverting it back to the previous valid value. #TINY-9754
- Selection was not correctly scrolled horizontally into view when using the `selection.scrollIntoView` API. #TINY-9747
- Context toolbars displayed the incorrect status for the `advlist` plugin buttons. #TINY-9680
- The image would not be inserted when using the `quickimage` button on Chrome. #TINY-9769
## 6.4.1 - 2023-03-29
### Fixed
- The `fontsizeinput` increase and decrease size buttons now work on TinyMCE mobile. #TINY-9725
- The TinyMCE editor toolbar is now accessible for all screen widths; it no longer collapses into an inaccessible vertical line when the screen is scrolled horizontally. #TINY-9646
- Reverted the changes made, in TinyMCE 6.4.0, to UI button colors in focus, active, and enabled states. #TINY-9176
## 6.4.0 - 2023-03-15
### Added
- New `tree` component that can be used in dialog body panel. #TINY-9532
- `renderUI` property in the `Theme` type can now return a `Promise<RenderResult>` instead of `RenderResult`. #TINY-9556
- New `isEditable` API to `editor.selection` that returns true or false if the current selection is editable. #TINY-9462
- New `isEditable` API to `editor.dom` that returns true or false if the specified node is editable. #TINY-9462
- New `setText` and `setIcon` methods added to menu button and toolbar button API. #TINY-9268
- New `highlight_on_focus` option which enables highlighting the content area on focus. #TINY-9277
- New `fontsizeinput` toolbar item which allows the user to set the size via input and also increase and decrease it with `+` and `-` buttons. #TINY-9429
- Added `skipFocus` option to the `ToggleToolbarDrawer` command to preserve focus. #TINY-9337
- New `font_size_input_default_unit` option allows entry of numbers without a unit in `fontsizeinput`. They are then parsed as the set unit. If `font_size_input_default_unit` is not set the default is `pt`. #TINY-9585
- New `group` and `togglebutton` in view. #TINY-9523
- New `togglebutton` in dialog footer buttons. #TINY-9523
- Added `toggleFullscreen` to dialog API. #TINY-9528
- New `text-size-increase` and `text-size-decrease` icons. #TINY-9530
- New `xss_sanitization` option to allow disabling of XSS sanitization. #TINY-9600
- Added the top right close button of modal dialogs to the tabbing order. The 'x' button in these dialogs can now be accessed using keyboard navigation. #TINY-9520
- New `ui_mode` option for editor in scrollable containers support. #TINY-9414
- The sidebar element now has the accessibility role `region` when visible and the accessibility role `presentation` when hidden. #TINY-9517
- The `tox-custom-editor` class now has a border highlight when it is selected. #TINY-9673
- An element could be dropped onto the decendants of an element with a `contenteditable="false"` attribute. #TINY-9364
- Checkmark did not show in menu color swatches. #TINY-9395
- Add support for navigating inside the tree component using arrow keys and shift key. #TINY-9614
### Improved
- Direct invalid child text nodes of list elements are now wrapped in list item elements. #TINY-4818
- Templates are now be parsed before preview and insertion to make preview consistent with inserted template content and prevent XSS. #TINY-9244
- Pressing backspace on an empty line now preserves formatting on the previous empty line. #TINY-9454
- Pressing enter inside the `inputfontsize` input field now moves focus back into the editor content. #TINY-9598
- Drag and drop events for elements with a `contenteditable="false"` attribute now includes target element details. #TINY-9599
- Updated focus, active, and enabled colors of UI buttons for improved contrast against the UI color. #TINY-9176
### Changed
- The `link` plugins context menu items no longer appears for links that include elements with a `contenteditable="false"` attribute. #TINY-9491
- The formatting of elements with a `contenteditable="false"` attribute are no longer cloned to new cells when new table rows are created. #TINY-9449
- Changed the color of `@dialog-table-border-color`, and added right padding to the first cell of dialog table. #TINY-9380
### Fixed
- Sometimes the editor would finish initializing before the silver theme would have finished loading. #TINY-9556
- The `searchreplace` modal closed incorrectly when clicking outside of the alert that pops up when no match is found. #TINY-9443
- The text color or background color picker toolbar buttons did not update when the text color or background color was changed using the equivalent commands in the Format menu. #TINY-9439
- The `onSetup` api function would not run when defining custom group toolbar button. #TINY-9496
- The foreground and background menu icons would not properly update to display the last used color. #TINY-9497
- Added new `setIconFill` function to `NestedMenuItemInstanceApi`. #TINY-9497
- Pasting links to text would sometimes not generate the correct undo stack in Safari. #TINY-9489
- Toolbar split buttons in `advlist` plugin now show the correct state when the cursor is in a checklist. #TINY-5167
- Dragging transparent elements into transparent block elements could produce invalid nesting of transparents. #TINY-9231
- The `editor.insertContent` API would insert contents inside elements with a `contenteditable="false"` attribute if the selection was inside the element. #TINY-9462
- Closing a dialog would scroll down the document in Safari. #TINY-9148
- Inline headers would not work in some situations when the editor was moved too far right horizontally. #TINY-8977
- Quick toolbars were incorrectly rendered during the dragging of elements with a `contenteditable="false"` attribute. #TINY-9305
- Selection of images, horizontal rules, tables or elements with a `contenteditable="false"` attribute was possible if they were within an element with a `contenteditable="false"` attribute. #TINY-9473
- Ranged deletion of formatted text using selection or a keyboard shortcut would sometimes cause Blink- and Webkit-based browsers to insert interpreted tags upon typing. This could result in inconsistent tags. #TINY-9302
- Visual characters were rendered inside elements with a `contenteditable="false"` attribute. #TINY-9474
- Lists with an element with a `contenteditable="false"` attribute as their root were incorrectly editable using list API commands, toolbar buttons and menu items. #TINY-9458
- Color picker dialog would not update the preview color if the hex input value was prefixed with the `#` character. #TINY-9457
- Table cell selection was possible even if the element being selected was within an element with a `contenteditable="false"` attribute. #TINY-9459
- Table commands were modifying tables that were within an element with a `contenteditable="false"` attribute. #TINY-9459
- Fake carets were rendered for elements with a `contenteditable="false"` attribute and for tables within an element with a `contenteditable="false"` attribute. #TINY-9459
- Textareas with scrollbars in dialogs would not render rounded corners correctly on some browsers. #TINY-9331
- It was possible to open links inside the editor if the editor root was an element with a `contenteditable="false"` attribute. #TINY-9470
- Inline boundary was rendered for boundary elements that had a `contenteditable="false"` attribute. #TINY-9471
- Clicking on a disabled split button will no longer call the `onAction` callback. #TINY-9504
- The *Edit Link* dialog incorrectly retrieved the URL value when opened immediately after the link insertion. #TINY-7993
- The `ForwardDelete` and `Delete` editor commands were deleting content within elements with a `contenteditable="false"` attribute. #TINY-9477
- The Backspace and Forward Delete keys were deleting content within elements with a `contenteditable="false"` attribute. #TINY-9477
- Inserting newlines inside an editable element that was inside an element with a `contenteditable="false"` attribute root would sometimes try to split the editable element. #TINY-9461
- Creating a list in a table cell when the caret is in front of an anchor element would not properly include the anchor in the list. #TINY-6853
- Dragging and dropping elements with a `contenteditable="false"` attribute on table borders would remove the element on drop. #TINY-9021
- Elements with a `contenteditable="false"` attribute would be removed when dragged and dropped within a root element with a `contenteditable="false"` attribute. #TINY-9558
- Formatting could be applied or removed to list items with a `contenteditable="false"` attribute that were inside an element with a `contenteditable="false"` attribute. #TINY-9563
- Annotation were not removed if the annotation was deleted immediately after being created. #TINY-9399
- Inserting a link for a selection from quickbars did not preserve formatting. #TINY-9593
- Inline dialog position was not correct when the editor was not inline and was contained in a `fixed` or `absolute` positioned element. #TINY-9554
- Sticky toolbars did not fade transition when undocking in classic iframe mode. #TINY-9408
- Inserting elements that were not valid within the closest editing host would incorrectly split the editing host. #TINY-9595
- The `color_cols` option was not respected in the `forecolor` or `backcolor` color swatches. #TINY-9560
- Drag and dropping the last element with a `contenteditable="false"` attribute out of its parent block would not properly pad the parent block element. #TINY-9606
- Applying heading formats from `text_patterns` produced an invisible space before a word. #TINY-9603
- Opening color swatches caused the browser tab to crash when `color_cols` or other column option was set to 0. #TINY-9649
- Opening a menu button in the footer of a dialog after a redial threw an error. #TINY-9686
- After closing a view, the `more...` toolbar button disappeared if the editor had `toolbar_mode: 'sliding'` and the toolbar was opened. #TINY-9419
- Inline dialogs would open partially off screen when the toolbar had a small width. #TINY-9588
## 6.3.2 - 2023-02-22
### Fixed
- Removed a workaround for ensuring stylesheets are loaded in an outdated version of webkit. #TINY-9433
## 6.3.1 - 2022-12-06
### Fixed
- HTML in messages for the `WindowManager.alert` and `WindowManager.confirm` APIs were not properly sanitized. #TINY-3548
## 6.3.0 - 2022-11-23
### Added
- New `expand` function added to `tinymce.selection` which expands the selection around the nearest word. #TINY-9001
- New `expand` function added to `tinymce.dom.RangeUtils` to return a new range expanded around the nearest word. #TINY-9001
- New `color_map_background` and `color_map_foreground` options which set the base colors used in the `backcolor` and `forecolor` toolbar buttons and menu items. #TINY-9184
- Added optional `storageKey` property to `colorinput` component and `colorswatch` fancy menu item. #TINY-9184
- New `addView` function added to `editor.ui.registry` which makes it possible to register custom editor views. #TINY-9210
- New `ToggleView` command which makes it possible to hide or show registered custom views. #TINY-9210
- New `color_default_foreground` and `color_default_background` options to set the initial default color for the `forecolor` and `backcolor` toolbar buttons and menu items. #TINY-9183
- New `getTransparentElements` function added to `tinymce.html.Schema` to return a map object of transparent HTML elements. #TINY-9172
- Added `ToggleToolbarDrawer` event to subscribe to toolbars opening and closing. #TINY-9271
### Changed
- Transparent elements, like anchors, are now allowed in the root of the editor body if they contain blocks. #TINY-9172
- Colorswatch keyboard navigation now starts on currently selected color if present in the colorswatch. #TINY-9283
- `setContent` is now allowed to accept any custom keys and values as a second options argument. #TINY-9143
### Improved
- Transparent elements, like anchors, can now contain block elements. #TINY-9172
- Colorswatch now displays a checkmark for selected color. #TINY-9283
- Color picker dialog now starts on the appropriate color for the cursor position. #TINY-9213
### Fixed
- Parsing media content would cause a memory leak, which for example occurred when using the `getContent` API. #TINY-9186
- Dragging a noneditable element toward the bottom edge would cause the page to scroll up. #TINY-9025
- Range expanding capabilities would behave inconsistently depending on where the cursor was placed. #TINY-9029
- Compilation errors were thrown when using TypeScript 4.8. #TINY-9161
- Line separator scrolling in floating toolbars. #TINY-8948
- A double bottom border appeared on inline mode editor for the `tinymce-5` skin. #TINY-9108
- The editor header showed up even with no menubar and toolbar configured. #TINY-8819
- Inline text pattern no longer triggers if it matches only the end but not the start. #TINY-8947
- Matches of inline text patterns that are similar are now managed correctly. #TINY-8949
- Using `editor.selection.getContent({ format: 'text' })` or `editor.getContent({ format: 'text' })` would sometimes deselect selected radio buttons. #TINY-9213
- The context toolbar prevented the user from placing the cursor at the edges of the editor. #TINY-8890
- The Quick Insert context toolbar provided by the `quickbars` plugin showed when the cursor was in a fake block caret. #TINY-9190
- The `editor.selection.getRng()` API was not returning a proper range on hidden editors in Firefox. #TINY-9259
- The `editor.selection.getBookmark()` API was not returning a proper bookmark on hidden editors in Firefox. #TINY-9259
- Dragging a noneditable element before or after another noneditable element now works correctly. #TINY-9253
- The restored selection after a redo or undo action was not scrolled into view. #TINY-9222
- A newline could not be inserted when the selection was restored from a bookmark after an inline element with a `contenteditable="false"` attribute. #TINY-9194
- The global `tinymce.dom.styleSheetLoader` was not affected by the `content_css_cors` option. #TINY-6037
- The caret was moved to the previous line when a text pattern executed a `mceInsertContent` command on Enter key when running on Firefox. #TINY-9193
- The `autoresize` plugin used to cause infinite resize when `content_css` is set to `document`. #TINY-8872
## 6.2.0 - 2022-09-08
### Added

View file

@ -1,6 +1,6 @@
{
"name": "tinymce/tinymce",
"version": "6.2.0",
"version": "6.4.2",
"description": "Web based JavaScript HTML WYSIWYG editor control.",
"license": [
"MIT-only"

View file

@ -96,11 +96,12 @@ tinymce.IconManager.add('default', {
'list-num-upper-roman': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 17v-1.2h1.3V17H15Zm0 10v-1.2h1.3V27H15Zm0 10v-1.2h1.3V37H15Z"/><path fill-rule="nonzero" d="M12 20h1.5v7H12zM12 30h1.5v7H12zM9 20h1.5v7H9zM9 30h1.5v7H9zM6 30h1.5v7H6zM12 10h1.5v7H12z"/></g></svg>',
'lock': '<svg width="24" height="24"><path d="M16.3 11c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H8V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h.3ZM10 8v3h4V8a1 1 0 0 0-.3-.7A1 1 0 0 0 13 7h-2a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7Z" fill-rule="evenodd"/></svg>',
'ltr': '<svg width="24" height="24"><path d="M11 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 7.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L11 5ZM4.4 16.2 6.2 15l-1.8-1.2a1 1 0 0 1 1.2-1.6l3 2a1 1 0 0 1 0 1.6l-3 2a1 1 0 1 1-1.2-1.6Z" fill-rule="evenodd"/></svg>',
'minus': '<svg width="24" height="24"><path d="M19 11a1 1 0 0 1 .1 2H5a1 1 0 0 1-.1-2H19Z"/></svg>',
'more-drawer': '<svg width="24" height="24"><path d="M6 10a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm12 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm-6 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Z" fill-rule="nonzero"/></svg>',
'new-document': '<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h10a2 2 0 0 0 2-2V7.6L14.4 3ZM17 19H7V5h6v4h4v10Z" fill-rule="nonzero"/></svg>',
'new-tab': '<svg width="24" height="24"><path d="m15 13 2-2v8H5V7h8l-2 2H7v8h8v-4Zm4-8v5.5l-2-2-5.6 5.5H10v-1.4L15.5 7l-2-2H19Z" fill-rule="evenodd"/></svg>',
'non-breaking': '<svg width="24" height="24"><path d="M11 11H8a1 1 0 1 1 0-2h3V6c0-.6.4-1 1-1s1 .4 1 1v3h3c.6 0 1 .4 1 1s-.4 1-1 1h-3v3c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-3Zm10 4v5H3v-5c0-.6.4-1 1-1s1 .4 1 1v3h14v-3c0-.6.4-1 1-1s1 .4 1 1Z" fill-rule="evenodd"/></svg>',
'notice': '<svg width="24" height="24"><path d="M17.8 9.8 15.4 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7l2.3 5.8Zm0 0 2.2 5.7-2.3-5.8ZM13 17v-2h-2v2h2Zm0-4V7h-2v6h2Z" fill-rule="evenodd"/></svg>',
'notice': '<svg width="24" height="24"><path d="M15.5 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7ZM13 17v-2h-2v2h2Zm0-4V7h-2v6h2Z" fill-rule="evenodd" clip-rule="evenodd"/></svg>',
'ordered-list-rtl': '<svg width="24" height="24"><path d="M6 17h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 1 1 0-2Zm13-1v3.5a.5.5 0 1 1-1 0V5h-.5a.5.5 0 1 1 0-1H19Zm-1 8.8.2.2h1.3a.5.5 0 1 1 0 1h-1.6a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2h-1.3a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3Zm2 4.2v2c0 .6-.4 1-1 1h-1.5a.5.5 0 0 1 0-1h1.2a.3.3 0 1 0 0-.6h-1.3a.4.4 0 1 1 0-.8h1.3a.3.3 0 0 0 0-.6h-1.2a.5.5 0 1 1 0-1H19c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',
'ordered-list': '<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2H4.5a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3ZM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 0 1 0-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 1 1 0-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 1 1 0-1H6c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',
'orientation': '<svg width="24" height="24"><path d="M7.3 6.4 1 13l6.4 6.5 6.5-6.5-6.5-6.5ZM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7ZM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 0 1 0-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 1 1-4.3 16.9l1.5-1.5A7 7 0 1 0 13 6h-1Z" fill-rule="nonzero"/></svg>',
@ -161,11 +162,15 @@ tinymce.IconManager.add('default', {
'table-split-cells': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM8 15.5H5V18h3v-2.5Zm11-5h-9V18h9v-7.5Zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2Zm-8.5-1H5v3h3v-3ZM19 6h-4v2.5h4V6ZM8 6H5v2.5h3V6Zm5 0h-3v2.5h3V6Z"/></svg>',
'table-top-header': '<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',
'table': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 14v4h6v-4H5Zm14 0h-6v4h6v-4Zm0-6h-6v4h6V8ZM5 12h6V8H5v4Z"/></svg>',
'template-add': '<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 12v4H5a2 2 0 0 0-2 2v3h9.3a6 6 0 0 1-.3-2H5v-1h7a6 6 0 0 1 .8-2H11v-5l-.8-.6a3 3 0 1 1 3.6 0l-.8.6v4.7a6 6 0 0 1 2-1.9V12a5 5 0 1 0-6 0Z"/><path d="M18 15c.5 0 1 .4 1 .9V18h2a1 1 0 0 1 .1 2H19v2a1 1 0 0 1-2 .1V20h-2a1 1 0 0 1-.1-2H17v-2c0-.6.4-1 1-1Z"/></svg>',
'template': '<svg width="24" height="24"><path d="M19 19v-1H5v1h14ZM9 16v-4a5 5 0 1 1 6 0v4h4a2 2 0 0 1 2 2v3H3v-3c0-1.1.9-2 2-2h4Zm4 0v-5l.8-.6a3 3 0 1 0-3.6 0l.8.6v5h2Z" fill-rule="nonzero"/></svg>',
'temporary-placeholder': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M9 7.6V6h2.5V4.5a.5.5 0 1 1 1 0V6H15v1.6a8 8 0 1 1-6 0Zm-2.6 5.3a.5.5 0 0 0 .3.6c.3 0 .6 0 .6-.3l.1-.2a5 5 0 0 1 3.3-2.8c.3-.1.4-.4.4-.6-.1-.3-.4-.5-.6-.4a6 6 0 0 0-4.1 3.7Z"/><circle cx="14" cy="4" r="1"/><circle cx="12" cy="2" r="1"/><circle cx="10" cy="4" r="1"/></g></svg>',
'text-color': '<svg width="24" height="24"><g fill-rule="evenodd"><path id="tox-icon-text-color__color" d="M3 18h18v3H3z"/><path d="M8.7 16h-.8a.5.5 0 0 1-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 0 1-.5.6h-.8a.5.5 0 0 1-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4Zm2.6-7.6-.6 2a.5.5 0 0 0 .5.6h1.6a.5.5 0 0 0 .5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4Z"/></g></svg>',
'text-size-decrease': '<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM14 12a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Z"/></svg>',
'text-size-increase': '<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM17 9a1 1 0 0 0-1 1v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2c0-.6-.4-1-1-1Z"/></svg>',
'toc': '<svg width="24" height="24"><path d="M5 5c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 1 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm0-4c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',
'translate': '<svg width="24" height="24"><path d="m12.7 14.3-.3.7-.4.7-2.2-2.2-3.1 3c-.3.4-.8.4-1 0a.7.7 0 0 1 0-1l3.1-3A12.4 12.4 0 0 1 6.7 9H8a10.1 10.1 0 0 0 1.7 2.4c.5-.5 1-1.1 1.4-1.8l.9-2H4.7a.7.7 0 1 1 0-1.5h4.4v-.7c0-.4.3-.8.7-.8.4 0 .7.4.7.8v.7H15c.4 0 .8.3.8.7 0 .4-.4.8-.8.8h-1.4a12.3 12.3 0 0 1-1 2.4 13.5 13.5 0 0 1-1.7 2.3l1.9 1.8Zm4.3-3 2.7 7.3a.5.5 0 0 1-.4.7 1 1 0 0 1-1-.7l-.6-1.5h-3.4l-.6 1.5a1 1 0 0 1-1 .7.5.5 0 0 1-.4-.7l2.7-7.4a1 1 0 0 1 2 0Zm-2.2 4.4h2.4L16 12.5l-1.2 3.2Z" fill-rule="evenodd"/></svg>',
'typography': '<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H7a1 1 0 0 1 0-2h10Z"/><path d="m17.5 14 .8-1.7 1.7-.8-1.7-.8-.8-1.7-.8 1.7-1.7.8 1.7.8.8 1.7ZM7 14l1 2 2 1-2 1-1 2-1-2-2-1 2-1 1-2Z"/></svg>',
'underline': '<svg width="24" height="24"><path d="M16 5c.6 0 1 .4 1 1v5.5a4 4 0 0 1-.4 1.8l-1 1.4a5.3 5.3 0 0 1-5.5 1 5 5 0 0 1-1.6-1c-.5-.4-.8-.9-1.1-1.4a4 4 0 0 1-.4-1.8V6c0-.6.4-1 1-1s1 .4 1 1v5.5c0 .3 0 .6.2 1l.6.7a3.3 3.3 0 0 0 2.2.8 3.4 3.4 0 0 0 2.2-.8c.3-.2.4-.5.6-.8l.2-.9V6c0-.6.4-1 1-1ZM8 17h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',
'undo': '<svg width="24" height="24"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"/></svg>',
'unlink': '<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2.1-2a2 2 0 1 0-2.7-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2ZM7.6 6.3a.8.8 0 0 1-1 1.1L3.3 4.2a.7.7 0 1 1 1-1l3.2 3.1ZM5.1 8.6a.8.8 0 0 1 0 1.5H3a.8.8 0 0 1 0-1.5H5Zm5-3.5a.8.8 0 0 1-1.5 0V3a.8.8 0 0 1 1.5 0V5Zm6 11.8a.8.8 0 0 1 1-1l3.2 3.2a.8.8 0 0 1-1 1L16 17Zm-2.2 2a.8.8 0 0 1 1.5 0V21a.8.8 0 0 1-1.5 0V19Zm5-3.5a.7.7 0 1 1 0-1.5H21a.8.8 0 0 1 0 1.5H19Z" fill-rule="nonzero"/></svg>',

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {
@ -383,7 +383,39 @@
return true;
};
typeof window !== 'undefined' ? window : Function('return this;')();
const Global = typeof window !== 'undefined' ? window : Function('return this;')();
const path = (parts, scope) => {
let o = scope !== undefined && scope !== null ? scope : Global;
for (let i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
o = o[parts[i]];
}
return o;
};
const resolve$2 = (p, scope) => {
const parts = p.split('.');
return path(parts, scope);
};
const unsafe = (name, scope) => {
return resolve$2(name, scope);
};
const getOrDie = (name, scope) => {
const actual = unsafe(name, scope);
if (actual === undefined || actual === null) {
throw new Error(name + ' not available on this browser');
}
return actual;
};
const getPrototypeOf = Object.getPrototypeOf;
const sandHTMLElement = scope => {
return getOrDie('HTMLElement', scope);
};
const isPrototypeOf = x => {
const scope = resolve$2('ownerDocument.defaultView', x);
return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf(x).constructor.name));
};
const COMMENT = 8;
const DOCUMENT = 9;
@ -398,6 +430,7 @@
const type = element => element.dom.nodeType;
const isType = t => element => type(element) === t;
const isComment = element => type(element) === COMMENT || name(element) === '#comment';
const isHTMLElement = element => isElement(element) && isPrototypeOf(element.dom);
const isElement = isType(ELEMENT);
const isText = isType(TEXT);
const isDocument = isType(DOCUMENT);
@ -2173,13 +2206,14 @@
const getEnd = element => name(element) === 'img' ? 1 : getOption(element).fold(() => children$2(element).length, v => v.length);
const isTextNodeWithCursorPosition = el => getOption(el).filter(text => text.trim().length !== 0 || text.indexOf(nbsp) > -1).isSome();
const isContentEditableFalse = elem => isHTMLElement(elem) && get$b(elem, 'contenteditable') === 'false';
const elementsWithCursorPosition = [
'img',
'br'
];
const isCursorPosition = elem => {
const hasCursorPosition = isTextNodeWithCursorPosition(elem);
return hasCursorPosition || contains$2(elementsWithCursorPosition, name(elem));
return hasCursorPosition || contains$2(elementsWithCursorPosition, name(elem)) || isContentEditableFalse(elem);
};
const first = element => descendant$1(element, isCursorPosition);
@ -2245,7 +2279,6 @@
});
return foldr(parents, (last, parent) => {
const clonedFormat = shallow(parent);
remove$7(clonedFormat, 'contenteditable');
append$1(last, clonedFormat);
return clonedFormat;
}, newCell);
@ -2323,6 +2356,16 @@
};
const fromDom = nodes => map$1(nodes, SugarElement.fromDom);
const closest = target => closest$1(target, '[contenteditable]');
const isEditable$1 = (element, assumeEditable = false) => {
if (inBody(element)) {
return element.dom.isContentEditable;
} else {
return closest(element).fold(constant(assumeEditable), editable => getRaw(editable) === 'true');
}
};
const getRaw = element => element.dom.contentEditable;
const getBody = editor => SugarElement.fromDom(editor.getBody());
const getIsRoot = editor => element => eq$1(element, getBody(editor));
const removeDataStyle = table => {
@ -2341,6 +2384,7 @@
};
const isPercentage$1 = value => /^(\d+(\.\d+)?)%$/.test(value);
const isPixel = value => /^(\d+(\.\d+)?)px$/.test(value);
const isInEditableContext$1 = cell => closest$2(cell, isTag('table')).exists(isEditable$1);
const inSelection = (bounds, detail) => {
const leftEdge = detail.column;
@ -3152,16 +3196,6 @@
fallback
};
const closest = target => closest$1(target, '[contenteditable]');
const isEditable$1 = (element, assumeEditable = false) => {
if (inBody(element)) {
return element.dom.isContentEditable;
} else {
return closest(element).fold(constant(assumeEditable), editable => getRaw(editable) === 'true');
}
};
const getRaw = element => element.dom.contentEditable;
const setIfNot = (element, property, value, ignore) => {
if (value === ignore) {
remove$7(element, property);
@ -5290,8 +5324,8 @@
const getColumns = () => getData(tableTypeColumn);
const clearColumns = () => clearData(tableTypeColumn);
const getSelectionStartCellOrCaption = editor => getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor));
const getSelectionStartCell = editor => getSelectionCell(getSelectionStart(editor), getIsRoot(editor));
const getSelectionStartCellOrCaption = editor => getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor)).filter(isInEditableContext$1);
const getSelectionStartCell = editor => getSelectionCell(getSelectionStart(editor), getIsRoot(editor)).filter(isInEditableContext$1);
const registerCommands = (editor, actions) => {
const isRoot = getIsRoot(editor);
const eraseTable = () => getSelectionStartCellOrCaption(editor).each(cellOrCaption => {
@ -5438,7 +5472,7 @@
if (!isObject(args)) {
return;
}
const cells = getCellsFromSelection(editor);
const cells = filter$2(getCellsFromSelection(editor), isInEditableContext$1);
if (cells.length === 0) {
return;
}
@ -6259,6 +6293,7 @@
};
const findCell = (target, isRoot) => closest$1(target, 'td,th', isRoot);
const isInEditableContext = cell => parentElement(cell).exists(isEditable$1);
const MouseSelection = (bridge, container, isRoot, annotations) => {
const cursor = value();
const clearstate = cursor.clear;
@ -6286,7 +6321,7 @@
};
const mousedown = event => {
annotations.clear(container);
findCell(event.target, isRoot).each(cursor.set);
findCell(event.target, isRoot).filter(isInEditableContext).each(cursor.set);
};
const mouseover = event => {
applySelection(event);
@ -6628,6 +6663,8 @@
mouseup: handlers.mouseup
};
};
const isEditableNode = node => closest$2(node, isHTMLElement).exists(isEditable$1);
const isEditableSelection = (start, finish) => isEditableNode(start) || isEditableNode(finish);
const keyboard = (win, container, isRoot, annotations) => {
const bridge = WindowBridge(win);
const clearToNavigate = () => {
@ -6642,7 +6679,9 @@
if (isNavigation(keycode) && !shiftKey) {
annotations.clearBeforeUpdate(container);
}
if (isDown(keycode) && shiftKey) {
if (isNavigation(keycode) && shiftKey && !isEditableSelection(start, finish)) {
return Optional.none;
} else if (isDown(keycode) && shiftKey) {
return curry(select, bridge, container, isRoot, down, finish, start, annotations.selectRange);
} else if (isUp(keycode) && shiftKey) {
return curry(select, bridge, container, isRoot, up, finish, start, annotations.selectRange);
@ -6671,7 +6710,9 @@
});
};
};
if (isDown(keycode) && shiftKey) {
if (isNavigation(keycode) && shiftKey && !isEditableSelection(start, finish)) {
return Optional.none;
} else if (isDown(keycode) && shiftKey) {
return update$1([rc(+1, 0)]);
} else if (isUp(keycode) && shiftKey) {
return update$1([rc(-1, 0)]);
@ -6701,7 +6742,7 @@
if (!shiftKey) {
return Optional.none();
}
if (isNavigation(keycode)) {
if (isNavigation(keycode) && isEditableSelection(start, finish)) {
return sync(container, isRoot, start, soffset, finish, foffset, annotations.selectRange);
} else {
return Optional.none();
@ -7335,6 +7376,7 @@
const off = () => {
active = false;
};
const isActive = () => active;
const runIfActive = f => {
return (...args) => {
if (active) {
@ -7356,6 +7398,7 @@
go,
on,
off,
isActive,
destroy,
events: events.registry
};
@ -7679,8 +7722,10 @@
destroy(wire);
}
}, table => {
hoverTable = Optional.some(table);
refresh(wire, table);
if (resizing.isActive()) {
hoverTable = Optional.some(table);
refresh(wire, table);
}
});
});
const destroy$1 = () => {
@ -7933,6 +7978,17 @@
}
});
});
editor.on('dragstart dragend', e => {
tableResize.on(resize => {
if (e.type === 'dragstart') {
resize.hideBars();
resize.off();
} else {
resize.on();
resize.showBars();
}
});
});
editor.on('remove', () => {
destroy();
});

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "tinymce",
"version": "6.2.0",
"version": "6.4.2",
"repository": {
"type": "git",
"url": "https://github.com/tinymce/tinymce.git",

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {
@ -134,54 +134,60 @@
}
Optional.singletonNone = new Optional(false);
const findUntil = (xs, pred, until) => {
for (let i = 0, len = xs.length; i < len; i++) {
const x = xs[i];
if (pred(x, i)) {
return Optional.some(x);
} else if (until(x, i)) {
break;
}
}
return Optional.none();
};
const isCustomList = list => /\btox\-/.test(list.className);
const isChildOfBody = (editor, elm) => {
return editor.dom.isChildOf(elm, editor.getBody());
};
const isTableCellNode = node => {
return isNonNullable(node) && /^(TH|TD)$/.test(node.nodeName);
};
const isListNode = editor => node => {
return isNonNullable(node) && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
};
const matchNodeNames = regex => node => isNonNullable(node) && regex.test(node.nodeName);
const isListNode = matchNodeNames(/^(OL|UL|DL)$/);
const isTableCellNode = matchNodeNames(/^(TH|TD)$/);
const inList = (editor, parents, nodeName) => findUntil(parents, parent => isListNode(parent) && !isCustomList(parent), isTableCellNode).exists(list => list.nodeName === nodeName && isChildOfBody(editor, list));
const getSelectedStyleType = editor => {
const listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
const style = editor.dom.getStyle(listElm, 'listStyleType');
return Optional.from(style);
};
const isWithinNonEditable = (editor, element) => element !== null && editor.dom.getContentEditableParent(element) === 'false';
const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
const isWithinNonEditableList = (editor, element) => {
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
return isWithinNonEditable(editor, parentList);
};
const findIndex = (list, predicate) => {
for (let index = 0; index < list.length; index++) {
const element = list[index];
if (predicate(element)) {
return index;
}
}
return -1;
const setNodeChangeHandler = (editor, nodeChangeHandler) => {
const initialNode = editor.selection.getNode();
nodeChangeHandler({
parents: editor.dom.getParents(initialNode),
element: initialNode
});
editor.on('NodeChange', nodeChangeHandler);
return () => editor.off('NodeChange', nodeChangeHandler);
};
const styleValueToText = styleValue => {
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, chr => {
return chr.toUpperCase();
});
};
const normalizeStyleValue = styleValue => isNullable(styleValue) || styleValue === 'default' ? '' : styleValue;
const isWithinList = (editor, e, nodeName) => {
const tableCellIndex = findIndex(e.parents, isTableCellNode);
const parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
const lists = global.grep(parents, isListNode(editor));
return lists.length > 0 && lists[0].nodeName === nodeName;
};
const makeSetupHandler = (editor, nodeName) => api => {
const nodeChangeHandler = e => {
api.setActive(isWithinList(editor, e, nodeName));
api.setEnabled(!isWithinNonEditableList(editor, e.element));
const updateButtonState = (editor, parents) => {
const element = editor.selection.getStart(true);
api.setActive(inList(editor, parents, nodeName));
api.setEnabled(!isWithinNonEditableList(editor, element));
};
editor.on('NodeChange', nodeChangeHandler);
return () => editor.off('NodeChange', nodeChangeHandler);
const nodeChangeHandler = e => updateButtonState(editor, e.parents);
return setNodeChangeHandler(editor, nodeChangeHandler);
};
const addSplitButton = (editor, id, tooltip, cmd, nodeName, styles) => {
editor.ui.registry.addSplitButton(id, {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,r)=>{const s="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(s,!1,!1===r?null:{"list-style-type":r})},r=t=>e=>e.options.get(t),s=r("advlist_number_styles"),n=r("advlist_bullet_styles"),l=t=>null==t,i=t=>!l(t);var o=tinymce.util.Tools.resolve("tinymce.util.Tools");class a{constructor(t,e){this.tag=t,this.value=e}static some(t){return new a(!0,t)}static none(){return a.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?a.some(t(this.value)):a.none()}bind(t){return this.tag?t(this.value):a.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:a.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return i(t)?a.some(t):a.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}a.singletonNone=new a(!1);const u=t=>i(t)&&/^(TH|TD)$/.test(t.nodeName),d=t=>l(t)||"default"===t?"":t,g=(t,e)=>r=>{const s=s=>{r.setActive(((t,e,r)=>{const s=((t,e)=>{for(let r=0;r<t.length;r++)if(e(t[r]))return r;return-1})(e.parents,u),n=-1!==s?e.parents.slice(0,s):e.parents,l=o.grep(n,(t=>e=>i(e)&&/^(OL|UL|DL)$/.test(e.nodeName)&&((t,e)=>t.dom.isChildOf(e,t.getBody()))(t,e))(t));return l.length>0&&l[0].nodeName===r})(t,s,e)),r.setEnabled(!((t,e)=>{const r=t.dom.getParent(e,"ol,ul,dl");return((t,e)=>null!==e&&"false"===t.dom.getContentEditableParent(e))(t,r)})(t,s.element))};return t.on("NodeChange",s),()=>t.off("NodeChange",s)},h=(t,r,s,n,l,i)=>{i.length>1?((t,r,s,n,l,i)=>{t.ui.registry.addSplitButton(r,{tooltip:s,icon:"OL"===l?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:t=>{t(o.map(i,(t=>{const e="OL"===l?"num":"bull",r="disc"===t||"decimal"===t?"default":t,s=d(t),n=(t=>t.replace(/\-/g," ").replace(/\b\w/g,(t=>t.toUpperCase())))(t);return{type:"choiceitem",value:s,icon:"list-"+e+"-"+r,text:n}})))},onAction:()=>t.execCommand(n),onItemAction:(r,s)=>{e(t,l,s)},select:e=>{const r=(t=>{const e=t.dom.getParent(t.selection.getNode(),"ol,ul"),r=t.dom.getStyle(e,"listStyleType");return a.from(r)})(t);return r.map((t=>e===t)).getOr(!1)},onSetup:g(t,l)})})(t,r,s,n,l,i):((t,r,s,n,l,i)=>{t.ui.registry.addToggleButton(r,{active:!1,tooltip:s,icon:"OL"===l?"ordered-list":"unordered-list",onSetup:g(t,l),onAction:()=>t.queryCommandState(n)||""===i?t.execCommand(n):e(t,l,i)})})(t,r,s,n,l,d(i[0]))};t.add("advlist",(t=>{t.hasPlugin("lists")?((t=>{const e=t.options.register;e("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),e("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})})(t),(t=>{h(t,"numlist","Numbered list","InsertOrderedList","OL",s(t)),h(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))})(t),(t=>{t.addCommand("ApplyUnorderedListStyle",((r,s)=>{e(t,"UL",s["list-style-type"])})),t.addCommand("ApplyOrderedListStyle",((r,s)=>{e(t,"OL",s["list-style-type"])}))})(t)):console.error("Please use the Lists plugin together with the Advanced List plugin.")}))}();
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,s)=>{const r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===s?null:{"list-style-type":s})},s=t=>e=>e.options.get(t),r=s("advlist_number_styles"),n=s("advlist_bullet_styles"),l=t=>null==t,i=t=>!l(t);var o=tinymce.util.Tools.resolve("tinymce.util.Tools");class a{constructor(t,e){this.tag=t,this.value=e}static some(t){return new a(!0,t)}static none(){return a.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?a.some(t(this.value)):a.none()}bind(t){return this.tag?t(this.value):a.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:a.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return i(t)?a.some(t):a.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}a.singletonNone=new a(!1);const u=t=>e=>i(e)&&t.test(e.nodeName),d=u(/^(OL|UL|DL)$/),g=u(/^(TH|TD)$/),c=t=>l(t)||"default"===t?"":t,h=(t,e)=>s=>((t,e)=>{const s=t.selection.getNode();return e({parents:t.dom.getParents(s),element:s}),t.on("NodeChange",e),()=>t.off("NodeChange",e)})(t,(r=>((t,r)=>{const n=t.selection.getStart(!0);s.setActive(((t,e,s)=>((t,e,s)=>{for(let e=0,n=t.length;e<n;e++){const n=t[e];if(d(r=n)&&!/\btox\-/.test(r.className))return a.some(n);if(s(n,e))break}var r;return a.none()})(e,0,g).exists((e=>e.nodeName===s&&((t,e)=>t.dom.isChildOf(e,t.getBody()))(t,e))))(t,r,e)),s.setEnabled(!((t,e)=>{const s=t.dom.getParent(e,"ol,ul,dl");return((t,e)=>null!==e&&!t.dom.isEditable(e))(t,s)})(t,n))})(t,r.parents))),m=(t,s,r,n,l,i)=>{i.length>1?((t,s,r,n,l,i)=>{t.ui.registry.addSplitButton(s,{tooltip:r,icon:"OL"===l?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:t=>{t(o.map(i,(t=>{const e="OL"===l?"num":"bull",s="disc"===t||"decimal"===t?"default":t,r=c(t),n=(t=>t.replace(/\-/g," ").replace(/\b\w/g,(t=>t.toUpperCase())))(t);return{type:"choiceitem",value:r,icon:"list-"+e+"-"+s,text:n}})))},onAction:()=>t.execCommand(n),onItemAction:(s,r)=>{e(t,l,r)},select:e=>{const s=(t=>{const e=t.dom.getParent(t.selection.getNode(),"ol,ul"),s=t.dom.getStyle(e,"listStyleType");return a.from(s)})(t);return s.map((t=>e===t)).getOr(!1)},onSetup:h(t,l)})})(t,s,r,n,l,i):((t,s,r,n,l,i)=>{t.ui.registry.addToggleButton(s,{active:!1,tooltip:r,icon:"OL"===l?"ordered-list":"unordered-list",onSetup:h(t,l),onAction:()=>t.queryCommandState(n)||""===i?t.execCommand(n):e(t,l,i)})})(t,s,r,n,l,c(i[0]))};t.add("advlist",(t=>{t.hasPlugin("lists")?((t=>{const e=t.options.register;e("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),e("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})})(t),(t=>{m(t,"numlist","Numbered list","InsertOrderedList","OL",r(t)),m(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))})(t),(t=>{t.addCommand("ApplyUnorderedListStyle",((s,r)=>{e(t,"UL",r["list-style-type"])})),t.addCommand("ApplyOrderedListStyle",((s,r)=>{e(t,"OL",r["list-style-type"])}))})(t)):console.error("Please use the Lists plugin together with the Advanced List plugin.")}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=("allow_html_in_named_anchor",e=>e.options.get("allow_html_in_named_anchor"));const a="a:not([href])",r=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),s=e=>e.dom.getParent(e.selection.getStart(),a),d=(e,a)=>{const r=s(e);r?((e,t,o)=>{o.removeAttribute("name"),o.id=t,e.addVisual(),e.undoManager.add()})(e,a,r):((e,a)=>{e.undoManager.transact((()=>{n(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:a})):((e=>{const n=e.dom;t(n).walk(e.selection.getRng(),(e=>{o.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&n.remove(e,!1)}))}))})(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:a}),e.addVisual())}))})(e,a),e.focus()},c=e=>(e=>r(e.attr("href"))&&!r(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,m=e=>t=>{for(let o=0;o<t.length;o++){const n=t[o];c(n)&&n.attr("contenteditable",e)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",m("false")),e.serializer.addNodeFilter("a",m(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{(e=>{const t=(e=>{const t=s(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(d(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})})(e)}))})(e),(e=>{const t=()=>e.execCommand("mceAnchor");e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:t,onSetup:t=>e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:a,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,o)=>l(e)})})(e)}))}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),n=t("autolink_pattern"),o=t("link_default_target"),r=t("link_default_protocol"),a=t("allow_unsafe_link_target"),s=("string",e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(a=o.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var n,o,r,a})(e));const l=(void 0,e=>undefined===e);const i=e=>!(e=>null==e)(e),c=Object.hasOwnProperty,d=e=>"\ufeff"===e;var u=tinymce.util.Tools.resolve("tinymce.dom.TextSeeker");const f=e=>/^[(\[{ \u00a0]$/.test(e),g=(e,t,n)=>{for(let o=t-1;o>=0;o--){const t=e.charAt(o);if(!d(t)&&n(t))return o}return-1},m=(e,t)=>{var o;const a=e.schema.getVoidElements(),s=n(e),{dom:i,selection:d}=e;if(null!==i.getParent(d.getNode(),"a[href]"))return null;const m=d.getRng(),k=u(i,(e=>{return i.isBlock(e)||(t=a,n=e.nodeName.toLowerCase(),c.call(t,n))||"false"===i.getContentEditable(e);var t,n})),{container:p,offset:y}=((e,t)=>{let n=e,o=t;for(;1===n.nodeType&&n.childNodes[o];)n=n.childNodes[o],o=3===n.nodeType?n.data.length:n.childNodes.length;return{container:n,offset:o}})(m.endContainer,m.endOffset),h=null!==(o=i.getParent(p,i.isBlock))&&void 0!==o?o:i.getRoot(),w=k.backwards(p,y+t,((e,t)=>{const n=e.data,o=g(n,t,(r=f,e=>!r(e)));var r,a;return-1===o||(a=n[o],/[?!,.;:]/.test(a))?o:o+1}),h);if(!w)return null;let v=w.container;const _=k.backwards(w.container,w.offset,((e,t)=>{v=e;const n=g(e.data,t,f);return-1===n?n:n+1}),h),A=i.createRng();_?A.setStart(_.container,_.offset):A.setStart(v,0),A.setEnd(w.container,w.offset);const C=A.toString().replace(/\uFEFF/g,"").match(s);if(C){let t=C[0];return $="www.",(b=t).length>=$.length&&b.substr(0,0+$.length)===$?t=r(e)+"://"+t:((e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!l(o)||r+t.length<=o)})(t,"@")&&!(e=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(e))(t)&&(t="mailto:"+t),{rng:A,url:t}}var b,$;return null},k=(e,t)=>{const{dom:n,selection:r}=e,{rng:l,url:i}=t,c=r.getBookmark();r.setRng(l);const d="createlink",u={command:d,ui:!1,value:i};if(!e.dispatch("BeforeExecCommand",u).isDefaultPrevented()){e.getDoc().execCommand(d,!1,i),e.dispatch("ExecCommand",u);const t=o(e);if(s(t)){const o=r.getNode();n.setAttrib(o,"target",t),"_blank"!==t||a(e)||n.setAttrib(o,"rel","noopener")}}r.moveToBookmark(c),e.nodeChanged()},p=e=>{const t=m(e,-1);i(t)&&k(e,t)},y=p;e.add("autolink",(e=>{(e=>{const t=e.options.register;t("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"})})(e),(e=>{e.on("keydown",(t=>{13!==t.keyCode||t.isDefaultPrevented()||(e=>{const t=m(e,0);i(t)&&k(e,t)})(e)})),e.on("keyup",(t=>{32===t.keyCode?p(e):(48===t.keyCode&&t.shiftKey||221===t.keyCode)&&y(e)}))})(e)}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {
@ -21,6 +21,12 @@
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
const constant = value => {
return () => {
return value;
};
};
var global = tinymce.util.Tools.resolve('tinymce.Env');
const fireResizeEditor = editor => editor.dispatch('ResizeEditor');
@ -65,7 +71,7 @@
return false;
}
};
const resize = (editor, oldSize, trigger) => {
const resize = (editor, oldSize, trigger, getExtraMarginBottom) => {
var _a;
const dom = editor.dom;
const doc = editor.getDoc();
@ -77,7 +83,7 @@
return;
}
const docEle = doc.documentElement;
const resizeBottomMargin = getAutoResizeBottomMargin(editor);
const resizeBottomMargin = getExtraMarginBottom ? getExtraMarginBottom() : getAutoResizeOverflowPadding(editor);
const minHeight = (_a = getMinHeight(editor)) !== null && _a !== void 0 ? _a : editor.getElement().offsetHeight;
let resizeHeight = minHeight;
const marginTop = parseCssValueToInt(dom, docEle, 'margin-top', true);
@ -112,23 +118,52 @@
editor.selection.scrollIntoView();
}
if ((global.browser.isSafari() || global.browser.isChromium()) && deltaSize < 0) {
resize(editor, oldSize, trigger);
resize(editor, oldSize, trigger, getExtraMarginBottom);
}
}
};
const setup = (editor, oldSize) => {
editor.on('init', () => {
let getExtraMarginBottom = () => getAutoResizeBottomMargin(editor);
let resizeCounter;
let sizeAfterFirstResize;
editor.on('init', e => {
resizeCounter = 0;
const overflowPadding = getAutoResizeOverflowPadding(editor);
const dom = editor.dom;
dom.setStyles(editor.getDoc().documentElement, { height: 'auto' });
dom.setStyles(editor.getBody(), {
'paddingLeft': overflowPadding,
'paddingRight': overflowPadding,
'min-height': 0
});
if (global.browser.isEdge() || global.browser.isIE()) {
dom.setStyles(editor.getBody(), {
'paddingLeft': overflowPadding,
'paddingRight': overflowPadding,
'min-height': 0
});
} else {
dom.setStyles(editor.getBody(), {
paddingLeft: overflowPadding,
paddingRight: overflowPadding
});
}
resize(editor, oldSize, e, getExtraMarginBottom);
resizeCounter += 1;
});
editor.on('NodeChange SetContent keyup FullscreenStateChanged ResizeContent', e => {
resize(editor, oldSize, e);
if (resizeCounter === 1) {
sizeAfterFirstResize = editor.getContainer().offsetHeight;
resize(editor, oldSize, e, getExtraMarginBottom);
resizeCounter += 1;
} else if (resizeCounter === 2) {
const isLooping = sizeAfterFirstResize < editor.getContainer().offsetHeight;
if (isLooping) {
const dom = editor.dom;
const doc = editor.getDoc();
dom.setStyles(doc.documentElement, { 'min-height': 0 });
dom.setStyles(editor.getBody(), { 'min-height': 'inherit' });
}
getExtraMarginBottom = isLooping ? constant(0) : getExtraMarginBottom;
resizeCounter += 1;
} else {
resize(editor, oldSize, e, getExtraMarginBottom);
}
});
};

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env");const o=e=>t=>t.options.get(e),n=o("min_height"),s=o("max_height"),i=o("autoresize_overflow_padding"),r=o("autoresize_bottom_margin"),l=(e,t)=>{const o=e.getBody();o&&(o.style.overflowY=t?"":"hidden",t||(o.scrollTop=0))},a=(e,t,o,n)=>{var s;const i=parseInt(null!==(s=e.getStyle(t,o,n))&&void 0!==s?s:"",10);return isNaN(i)?0:i},g=(e,o,i)=>{var c;const u=e.dom,d=e.getDoc();if(!d)return;if((e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen())(e))return void l(e,!0);const f=d.documentElement,m=r(e),p=null!==(c=n(e))&&void 0!==c?c:e.getElement().offsetHeight;let h=p;const v=a(u,f,"margin-top",!0),y=a(u,f,"margin-bottom",!0);let C=f.offsetHeight+v+y+m;C<0&&(C=0);const S=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight;C+S>p&&(h=C+S);const z=s(e);if(z&&h>z?(h=z,l(e,!0)):l(e,!1),h!==o.get()){const n=h-o.get();if(u.setStyle(e.getContainer(),"height",h+"px"),o.set(h),(e=>{e.dispatch("ResizeEditor")})(e),t.browser.isSafari()&&(t.os.isMacOS()||t.os.isiOS())){const t=e.getWin();t.scrollTo(t.pageXOffset,t.pageYOffset)}e.hasFocus()&&(e=>{if("setcontent"===(null==e?void 0:e.type.toLowerCase())){const t=e;return!0===t.selection||!0===t.paste}return!1})(i)&&e.selection.scrollIntoView(),(t.browser.isSafari()||t.browser.isChromium())&&n<0&&g(e,o,i)}};e.add("autoresize",(e=>{if((e=>{const t=e.options.register;t("autoresize_overflow_padding",{processor:"number",default:1}),t("autoresize_bottom_margin",{processor:"number",default:50})})(e),e.options.isSet("resize")||e.options.set("resize",!1),!e.inline){const t=(e=>{let t=0;return{get:()=>t,set:e=>{t=e}}})();((e,t)=>{e.addCommand("mceAutoResize",(()=>{g(e,t)}))})(e,t),((e,t)=>{e.on("init",(()=>{const t=i(e),o=e.dom;o.setStyles(e.getDoc().documentElement,{height:"auto"}),o.setStyles(e.getBody(),{paddingLeft:t,paddingRight:t,"min-height":0})})),e.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",(o=>{g(e,t,o)}))})(e,t)}}))}();
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env");const o=e=>t=>t.options.get(e),s=o("min_height"),i=o("max_height"),n=o("autoresize_overflow_padding"),r=o("autoresize_bottom_margin"),l=(e,t)=>{const o=e.getBody();o&&(o.style.overflowY=t?"":"hidden",t||(o.scrollTop=0))},g=(e,t,o,s)=>{var i;const n=parseInt(null!==(i=e.getStyle(t,o,s))&&void 0!==i?i:"",10);return isNaN(n)?0:n},a=(e,o,r,c)=>{var d;const f=e.dom,u=e.getDoc();if(!u)return;if((e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen())(e))return void l(e,!0);const m=u.documentElement,h=c?c():n(e),p=null!==(d=s(e))&&void 0!==d?d:e.getElement().offsetHeight;let y=p;const S=g(f,m,"margin-top",!0),v=g(f,m,"margin-bottom",!0);let C=m.offsetHeight+S+v+h;C<0&&(C=0);const b=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight;C+b>p&&(y=C+b);const w=i(e);if(w&&y>w?(y=w,l(e,!0)):l(e,!1),y!==o.get()){const s=y-o.get();if(f.setStyle(e.getContainer(),"height",y+"px"),o.set(y),(e=>{e.dispatch("ResizeEditor")})(e),t.browser.isSafari()&&(t.os.isMacOS()||t.os.isiOS())){const t=e.getWin();t.scrollTo(t.pageXOffset,t.pageYOffset)}e.hasFocus()&&(e=>{if("setcontent"===(null==e?void 0:e.type.toLowerCase())){const t=e;return!0===t.selection||!0===t.paste}return!1})(r)&&e.selection.scrollIntoView(),(t.browser.isSafari()||t.browser.isChromium())&&s<0&&a(e,o,r,c)}};e.add("autoresize",(e=>{if((e=>{const t=e.options.register;t("autoresize_overflow_padding",{processor:"number",default:1}),t("autoresize_bottom_margin",{processor:"number",default:50})})(e),e.options.isSet("resize")||e.options.set("resize",!1),!e.inline){const o=(e=>{let t=0;return{get:()=>t,set:e=>{t=e}}})();((e,t)=>{e.addCommand("mceAutoResize",(()=>{a(e,t)}))})(e,o),((e,o)=>{let s,i,l=()=>r(e);e.on("init",(i=>{s=0;const r=n(e),g=e.dom;g.setStyles(e.getDoc().documentElement,{height:"auto"}),t.browser.isEdge()||t.browser.isIE()?g.setStyles(e.getBody(),{paddingLeft:r,paddingRight:r,"min-height":0}):g.setStyles(e.getBody(),{paddingLeft:r,paddingRight:r}),a(e,o,i,l),s+=1})),e.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",(t=>{if(1===s)i=e.getContainer().offsetHeight,a(e,o,t,l),s+=1;else if(2===s){const t=i<e.getContainer().offsetHeight;if(t){const t=e.dom,o=e.getDoc();t.setStyles(o.documentElement,{"min-height":0}),t.setStyles(e.getBody(),{"min-height":"inherit"})}l=t?(0,()=>0):l,s+=1}else a(e,o,t,l)}))})(e,o)}}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":e;var r,o,a,s})(t));const r=(void 0,t=>undefined===t);var o=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),s=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=t=>{const e=/^(\d+)([ms]?)$/.exec(t);return(e&&e[2]?{s:1e3,m:6e4}[e[2]]:1)*parseInt(t,10)},i=t=>e=>e.options.get(t),u=i("autosave_ask_before_unload"),l=i("autosave_restore_when_empty"),c=i("autosave_interval"),d=i("autosave_retention"),m=t=>{const e=document.location;return t.options.get("autosave_prefix").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},v=(t,e)=>{if(r(e))return t.dom.isEmpty(t.getBody());{const r=s.trim(e);if(""===r)return!0;{const e=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(e)}}},f=t=>{var e;const r=parseInt(null!==(e=a.getItem(m(t)+"time"))&&void 0!==e?e:"0",10)||0;return!((new Date).getTime()-r>d(t)&&(p(t,!1),1))},p=(t,e)=>{const r=m(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&(t=>{t.dispatch("RemoveDraft")})(t)},g=t=>{const e=m(t);!v(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),(t=>{t.dispatch("StoreDraft")})(t))},y=t=>{var e;const r=m(t);f(t)&&(t.setContent(null!==(e=a.getItem(r+"draft"))&&void 0!==e?e:"",{format:"raw"}),(t=>{t.dispatch("RestoreDraft")})(t))};var D=tinymce.util.Tools.resolve("tinymce.EditorManager");const h=t=>e=>{e.setEnabled(f(t));const r=()=>e.setEnabled(f(t));return t.on("StoreDraft RestoreDraft RemoveDraft",r),()=>t.off("StoreDraft RestoreDraft RemoveDraft",r)};t.add("autosave",(t=>((t=>{const r=t.options.register,o=t=>{const r=e(t);return r?{value:n(t),valid:r}:{valid:!1,message:"Must be a string."}};r("autosave_ask_before_unload",{processor:"boolean",default:!0}),r("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),r("autosave_restore_when_empty",{processor:"boolean",default:!1}),r("autosave_interval",{processor:o,default:"30s"}),r("autosave_retention",{processor:o,default:"20m"})})(t),(t=>{t.editorManager.on("BeforeUnload",(t=>{let e;s.each(D.get(),(t=>{t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))})),e&&(t.preventDefault(),t.returnValue=e)}))})(t),(t=>{(t=>{const e=c(t);o.setEditorInterval(t,(()=>{g(t)}),e)})(t);const e=()=>{(t=>{t.undoManager.transact((()=>{y(t),p(t)})),t.focus()})(t)};t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)})})(t),t.on("init",(()=>{l(t)&&t.dom.isEmpty(t.getBody())&&y(t)})),(t=>({hasDraft:()=>f(t),storeDraft:()=>g(t),restoreDraft:()=>y(t),removeDraft:e=>p(t,e),isEmpty:e=>v(t,e)}))(t))))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",(e=>((e=>{e.addCommand("mceCodeEditor",(()=>{(e=>{const o=(e=>e.getContent({source_view:!0}))(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:o},onSubmit:o=>{((e,o)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(o)})),e.selection.setCursorLocation(),e.nodeChanged()})(e,o.getData().code),o.close()}})})(e)}))})(e),(e=>{const o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:o})})(e),{})))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,o=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=r=t,(n=String).prototype.isPrototypeOf(o)||(null===(i=r.constructor)||void 0===i?void 0:i.name)===n.name)?"string":e;var o,r,n,i})(t),r=e("boolean"),n=t=>!(t=>null==t)(t),i=e("function"),s=e("number"),l=(!1,()=>false);class a{constructor(t,e){this.tag=t,this.value=e}static some(t){return new a(!0,t)}static none(){return a.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?a.some(t(this.value)):a.none()}bind(t){return this.tag?t(this.value):a.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:a.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return n(t)?a.some(t):a.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}a.singletonNone=new a(!1);const u=(t,e)=>{for(let o=0,r=t.length;o<r;o++)e(t[o],o)},c=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},d=c,h=(t,e)=>{const o=t.dom;if(1!==o.nodeType)return!1;{const t=o;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}};"undefined"!=typeof window?window:Function("return this;")();const m=t=>e=>(t=>t.dom.nodeType)(e)===t,g=m(1),f=m(3),v=m(9),p=m(11),y=(t,e)=>{t.dom.removeAttribute(e)},w=i(Element.prototype.attachShadow)&&i(Node.prototype.getRootNode)?t=>d(t.dom.getRootNode()):t=>v(t)?t:d(t.dom.ownerDocument),N=t=>d(t.dom.host),b=t=>{const e=f(t)?t.dom.parentNode:t.dom;if(null==e||null===e.ownerDocument)return!1;const o=e.ownerDocument;return(t=>{const e=w(t);return p(o=e)&&n(o.dom.host)?a.some(e):a.none();var o})(d(e)).fold((()=>o.body.contains(e)),(r=b,i=N,t=>r(i(t))));var r,i},S=t=>"rtl"===((t,e)=>{const o=t.dom,r=window.getComputedStyle(o).getPropertyValue(e);return""!==r||b(t)?r:((t,e)=>(t=>void 0!==t.style&&i(t.style.getPropertyValue))(t)?t.style.getPropertyValue(e):"")(o,e)})(t,"direction")?"rtl":"ltr",A=(t,e)=>((t,o)=>((t,e)=>{const o=[];for(let r=0,n=t.length;r<n;r++){const n=t[r];e(n,r)&&o.push(n)}return o})(((t,e)=>{const o=t.length,r=new Array(o);for(let n=0;n<o;n++){const o=t[n];r[n]=e(o,n)}return r})(t.dom.childNodes,d),(t=>h(t,e))))(t),T=("li",t=>g(t)&&"li"===t.dom.nodeName.toLowerCase());const C=(t,e)=>{const n=t.selection.getSelectedBlocks();n.length>0&&(u(n,(t=>{const n=d(t),c=T(n),m=((t,e)=>{return(e?(o=t,r="ol,ul",((t,e,o)=>{let n=t.dom;const s=i(o)?o:l;for(;n.parentNode;){n=n.parentNode;const t=d(n);if(h(t,r))return a.some(t);if(s(t))break}return a.none()})(o,0,n)):a.some(t)).getOr(t);var o,r,n})(n,c);var f;(f=m,(t=>a.from(t.dom.parentNode).map(d))(f).filter(g)).each((t=>{if(S(t)!==e?((t,e,n)=>{((t,e,n)=>{if(!(o(n)||r(n)||s(n)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",n,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(e,n+"")})(t.dom,e,n)})(m,"dir",e):S(m)!==e&&y(m,"dir"),c){const t=A(m,"li[dir]");u(t,(t=>y(t,"dir")))}}))})),t.nodeChanged())},D=(t,e)=>o=>{const r=t=>{const r=d(t.element);o.setActive(S(r)===e)};return t.on("NodeChange",r),()=>t.off("NodeChange",r)};t.add("directionality",(t=>{(t=>{t.addCommand("mceDirectionLTR",(()=>{C(t,"ltr")})),t.addCommand("mceDirectionRTL",(()=>{C(t,"rtl")}))})(t),(t=>{t.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:()=>t.execCommand("mceDirectionLTR"),onSetup:D(t,"ltr")}),t.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:()=>t.execCommand("mceDirectionRTL"),onSetup:D(t,"rtl")})})(t)}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {
@ -627,6 +627,12 @@
name: 'Advanced Tables',
type: 'premium'
},
{
key: 'advtemplate',
name: 'Advanced Templates',
type: 'premium',
slug: 'advanced-templates'
},
{
key: 'casechange',
name: 'Case Change',
@ -647,6 +653,12 @@
name: 'Footnotes',
type: 'premium'
},
{
key: 'typography',
name: 'Advanced Typography',
type: 'premium',
slug: 'advanced-typography'
},
{
key: 'mediaembed',
name: 'Enhanced Media Embed',
@ -663,6 +675,12 @@
name: 'Format Painter',
type: 'premium'
},
{
key: 'inlinecss',
name: 'Inline CSS',
type: 'premium',
slug: 'inline-css'
},
{
key: 'linkchecker',
name: 'Link Checker',
@ -711,6 +729,11 @@
name: 'Spelling Autocorrect',
type: 'premium'
},
{
key: 'tableofcontents',
name: 'Table of Contents',
type: 'premium'
},
{
key: 'tinycomments',
name: 'Tiny Comments',
@ -722,11 +745,6 @@
name: 'Tiny Drive',
type: 'premium',
slug: 'tinydrive-introduction'
},
{
key: 'tableofcontents',
name: 'Table of Contents',
type: 'premium'
}
], item => ({
...item,
@ -891,7 +909,7 @@
};
editor.windowManager.open({
title: 'Help',
size: 'medium',
size: 'normal',
body,
buttons: [{
type: 'cancel',

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(s=r=e,(o=String).prototype.isPrototypeOf(s)||(null===(n=r.constructor)||void 0===n?void 0:n.name)===o.name)?"string":t;var s,r,o,n})(t)===e,s=t("string"),r=t("object"),o=t("array"),n=("function",e=>"function"==typeof e);var c=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),i=tinymce.util.Tools.resolve("tinymce.EditorManager"),l=tinymce.util.Tools.resolve("tinymce.Env"),a=tinymce.util.Tools.resolve("tinymce.util.Tools");const p=e=>t=>t.options.get(e),u=p("importcss_merge_classes"),m=p("importcss_exclusive"),f=p("importcss_selector_converter"),y=p("importcss_selector_filter"),d=p("importcss_groups"),h=p("importcss_append"),_=p("importcss_file_filter"),g=p("skin"),v=p("skin_url"),b=Array.prototype.push,x=/^\.(?:ephox|tiny-pageembed|mce)(?:[.-]+\w+)+$/,T=e=>s(e)?t=>-1!==t.indexOf(e):e instanceof RegExp?t=>e.test(t):e,S=(e,t)=>{let s={};const r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(!r)return;const o=r[1],n=r[2].substr(1).split(".").join(" "),c=a.makeMap("a,img");return r[1]?(s={title:t},e.schema.getTextBlockElements()[o]?s.block=o:e.schema.getBlockElements()[o]||c[o.toLowerCase()]?s.selector=o:s.inline=o):r[2]&&(s={inline:"span",title:t.substr(1),classes:n}),u(e)?s.classes=n:s.attributes={class:n},s},k=(e,t)=>null===t||m(e),w=e=>{e.on("init",(()=>{const t=(()=>{const e=[],t=[],s={};return{addItemToGroup:(e,r)=>{s[e]?s[e].push(r):(t.push(e),s[e]=[r])},addItem:t=>{e.push(t)},toFormats:()=>{return(r=t,n=e=>{const t=s[e];return 0===t.length?[]:[{title:e,items:t}]},(e=>{const t=[];for(let s=0,r=e.length;s<r;++s){if(!o(e[s]))throw new Error("Arr.flatten item "+s+" was not an array, input: "+e);b.apply(t,e[s])}return t})(((e,t)=>{const s=e.length,r=new Array(s);for(let o=0;o<s;o++){const s=e[o];r[o]=t(s,o)}return r})(r,n))).concat(e);var r,n}}})(),r={},n=T(y(e)),p=(e=>a.map(e,(e=>a.extend({},e,{original:e,selectors:{},filter:T(e.filter)}))))(d(e)),u=(t,s)=>{if(((e,t,s,r)=>!(k(e,s)?t in r:t in s.selectors))(e,t,s,r)){((e,t,s,r)=>{k(e,s)?r[t]=!0:s.selectors[t]=!0})(e,t,s,r);const o=((e,t,s,r)=>{let o;const n=f(e);return o=r&&r.selector_converter?r.selector_converter:n||(()=>S(e,s)),o.call(t,s,r)})(e,e.plugins.importcss,t,s);if(o){const t=o.name||c.DOM.uniqueId();return e.formatter.register(t,o),{title:o.title,format:t}}}return null};a.each(((e,t,r)=>{const o=[],n={},c=(t,n)=>{let p,u=t.href;if(u=(e=>{const t=l.cacheSuffix;return s(e)&&(e=e.replace("?"+t,"").replace("&"+t,"")),e})(u),u&&(!r||r(u,n))&&!((e,t)=>{const s=g(e);if(s){const r=v(e),o=r?e.documentBaseURI.toAbsolute(r):i.baseURL+"/skins/ui/"+s,n=i.baseURL+"/skins/content/";return t===o+"/content"+(e.inline?".inline":"")+".min.css"||-1!==t.indexOf(n)}return!1})(e,u)){a.each(t.imports,(e=>{c(e,!0)}));try{p=t.cssRules||t.rules}catch(e){}a.each(p,(e=>{e.styleSheet?c(e.styleSheet,!0):e.selectorText&&a.each(e.selectorText.split(","),(e=>{o.push(a.trim(e))}))}))}};a.each(e.contentCSS,(e=>{n[e]=!0})),r||(r=(e,t)=>t||n[e]);try{a.each(t.styleSheets,(e=>{c(e)}))}catch(e){}return o})(e,e.getDoc(),T(_(e))),(e=>{if(!x.test(e)&&(!n||n(e))){const s=((e,t)=>a.grep(e,(e=>!e.filter||e.filter(t))))(p,e);if(s.length>0)a.each(s,(s=>{const r=u(e,s);r&&t.addItemToGroup(s.title,r)}));else{const s=u(e,null);s&&t.addItem(s)}}}));const m=t.toFormats();e.dispatch("addStyleModifications",{items:m,replace:!h(e)})}))};e.add("importcss",(e=>((e=>{const t=e.options.register,o=e=>s(e)||n(e)||r(e);t("importcss_merge_classes",{processor:"boolean",default:!0}),t("importcss_exclusive",{processor:"boolean",default:!0}),t("importcss_selector_converter",{processor:"function"}),t("importcss_selector_filter",{processor:o}),t("importcss_file_filter",{processor:o}),t("importcss_groups",{processor:"object[]"}),t("importcss_append",{processor:"boolean",default:!1})})(e),w(e),(e=>({convertSelectorToFormat:t=>S(e,t)}))(e))))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {

View file

@ -1,4 +1,4 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),a=t("insertdatetime_dateformat"),r=t("insertdatetime_timeformat"),n=t("insertdatetime_formats"),s=t("insertdatetime_element"),i="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),o="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),l="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),m="January February March April May June July August September October November December".split(" "),c=(e,t)=>{if((e=""+e).length<t)for(let a=0;a<t-e.length;a++)e="0"+e;return e},d=(e,t,a=new Date)=>(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+a.getFullYear())).replace("%y",""+a.getYear())).replace("%m",c(a.getMonth()+1,2))).replace("%d",c(a.getDate(),2))).replace("%H",""+c(a.getHours(),2))).replace("%M",""+c(a.getMinutes(),2))).replace("%S",""+c(a.getSeconds(),2))).replace("%I",""+((a.getHours()+11)%12+1))).replace("%p",a.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(m[a.getMonth()]))).replace("%b",""+e.translate(l[a.getMonth()]))).replace("%A",""+e.translate(o[a.getDay()]))).replace("%a",""+e.translate(i[a.getDay()]))).replace("%%","%"),u=(e,t)=>{if(s(e)){const a=d(e,t);let r;r=/%[HMSIp]/.test(t)?d(e,"%Y-%m-%dT%H:%M"):d(e,"%Y-%m-%d");const n=e.dom.getParent(e.selection.getStart(),"time");n?((e,t,a,r)=>{const n=e.dom.create("time",{datetime:a},r);e.dom.replace(n,t),e.selection.select(n,!0),e.selection.collapse(!1)})(e,n,r,a):e.insertContent('<time datetime="'+r+'">'+a+"</time>")}else e.insertContent(d(e,t))};var p=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("insertdatetime",(e=>{(e=>{const t=e.options.register;t("insertdatetime_dateformat",{processor:"string",default:e.translate("%Y-%m-%d")}),t("insertdatetime_timeformat",{processor:"string",default:e.translate("%H:%M:%S")}),t("insertdatetime_formats",{processor:"string[]",default:["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"]}),t("insertdatetime_element",{processor:"boolean",default:!1})})(e),(e=>{e.addCommand("mceInsertDate",((t,r)=>{u(e,null!=r?r:a(e))})),e.addCommand("mceInsertTime",((t,a)=>{u(e,null!=a?a:r(e))}))})(e),(e=>{const t=n(e),a=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})((e=>{const t=n(e);return t.length>0?t[0]:r(e)})(e)),s=t=>e.execCommand("mceInsertDate",!1,t);e.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:e=>e===a.get(),fetch:a=>{a(p.map(t,(t=>({type:"choiceitem",text:d(e,t),value:t}))))},onAction:e=>{s(a.get())},onItemAction:(e,t)=>{a.set(t),s(t)}});const i=e=>()=>{a.set(e),s(e)};e.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:()=>p.map(t,(t=>({type:"menuitem",text:d(e,t),onAction:i(t)})))})})(e)}))}();

View file

@ -1,5 +1,5 @@
/**
* TinyMCE version 6.2.0 (2022-09-08)
* TinyMCE version 6.4.2 (2023-04-26)
*/
(function () {
@ -407,7 +407,7 @@
};
const trimCaretContainers = text => text.replace(/\uFEFF/g, '');
const getAnchorElement = (editor, selectedElm) => {
selectedElm = selectedElm || editor.selection.getNode();
selectedElm = selectedElm || getLinksInSelection(editor.selection.getRng())[0] || editor.selection.getNode();
if (isImageFigure(selectedElm)) {
return Optional.from(editor.dom.select('a[href]', selectedElm)[0]);
} else {
@ -419,13 +419,24 @@
const text = anchorElm.fold(() => selection.getContent({ format: 'text' }), anchorElm => anchorElm.innerText || anchorElm.textContent || '');
return trimCaretContainers(text);
};
const hasLinks = elements => global$4.grep(elements, isLink).length > 0;
const hasLinksInSelection = rng => collectNodesInRange(rng, isLink).length > 0;
const getLinksInSelection = rng => collectNodesInRange(rng, isLink);
const getLinks$1 = elements => global$4.grep(elements, isLink);
const hasLinks = elements => getLinks$1(elements).length > 0;
const hasLinksInSelection = rng => getLinksInSelection(rng).length > 0;
const isOnlyTextSelected = editor => {
const inlineTextElements = editor.schema.getTextInlineElements();
const isElement = elm => elm.nodeType === 1 && !isAnchor(elm) && !has(inlineTextElements, elm.nodeName.toLowerCase());
const elements = collectNodesInRange(editor.selection.getRng(), isElement);
return elements.length === 0;
const isInBlockAnchor = getAnchorElement(editor).exists(anchor => anchor.hasAttribute('data-mce-block'));
if (isInBlockAnchor) {
return false;
}
const rng = editor.selection.getRng();
if (!rng.collapsed) {
const elements = collectNodesInRange(rng, isElement);
return elements.length === 0;
} else {
return true;
}
};
const isImageFigure = elm => isNonNullable(elm) && elm.nodeName === 'FIGURE' && /\bimage\b/i.test(elm.className);
const getLinkAttrs = data => {
@ -1037,8 +1048,12 @@
updateState();
return toggleState(editor, updateState);
};
const hasExactlyOneLinkInSelection = editor => {
const links = editor.selection.isCollapsed() ? getLinks$1(editor.dom.getParents(editor.selection.getStart())) : getLinksInSelection(editor.selection.getRng());
return links.length === 1;
};
const toggleEnabledState = editor => api => {
const updateState = () => api.setEnabled(isInAnchor(editor, editor.selection.getNode()));
const updateState = () => api.setEnabled(hasExactlyOneLinkInSelection(editor));
updateState();
return toggleState(editor, updateState);
};
@ -1098,7 +1113,15 @@
const setupContextMenu = editor => {
const inLink = 'link unlink openlink';
const noLink = 'link';
editor.ui.registry.addContextMenu('link', { update: element => hasLinks(editor.dom.getParents(element, 'a')) ? inLink : noLink });
editor.ui.registry.addContextMenu('link', {
update: element => {
const isEditable = editor.dom.isEditable(element);
if (!isEditable) {
return '';
}
return hasLinks(editor.dom.getParents(element, 'a')) ? inLink : noLink;
}
});
};
const setupContextToolbars = editor => {
const collapseSelectionToEnd = editor => {
@ -1114,7 +1137,7 @@
const onlyText = isOnlyTextSelected(editor);
if (anchor.isNone() && onlyText) {
const text = getAnchorText(editor.selection, anchor);
return Optional.some(text.length > 0 ? text : value);
return someIf(text.length === 0, value);
} else {
return Optional.none();
}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more