add sentry
This commit is contained in:
parent
c7cd229cae
commit
4d74e55265
13
README.md
13
README.md
@ -1,7 +1,5 @@
|
||||
<div align="center">
|
||||
|
||||
|
||||
|
||||
# **Open Source Stock Analysis for Data Freaks**
|
||||
|
||||
<h3>
|
||||
@ -14,30 +12,35 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
# Techstack
|
||||
|
||||
This is the codebase that powers [stocknear's](https://stocknear.com/) frontend, which is an open-source stock analysis & community platform.
|
||||
|
||||
Built with:
|
||||
|
||||
- [Sveltekit](https://kit.svelte.dev/): Frontend
|
||||
- [Tailwindcss](https://tailwindcss.com/): Styling
|
||||
- [DaisyUI](https://daisyui.com/): Styling
|
||||
|
||||
# Getting started
|
||||
|
||||
Coming soon to run stocknear locally on your machine.
|
||||
|
||||
# Contributing
|
||||
|
||||
Stocknear is open-source software and you're welcome to contribute to its development.
|
||||
|
||||
The core idea of stocknear shall always be: ***Fast*** & ***Simple***.
|
||||
The core idea of stocknear shall always be: **_Fast_** & **_Simple_**.
|
||||
|
||||
If want to contribute to the codebase please follow these guidelines:
|
||||
|
||||
- Refactoring slow code into fast code is a huge plus!
|
||||
- Reducing complexity and increasing simplicity/readability is a huge plus!
|
||||
- If your PR looks "complex", is a big diff, or adds lots of lines, it won't be reviewed or merged. Consider breaking it up into smaller PRs that are individually clear wins. A common pattern I see is prerequisite refactors before adding new functionality. If you can (cleanly) refactor to the point that the feature is a 3 line change, this is great, and something easy for us to review.
|
||||
|
||||
# Support ❤️
|
||||
|
||||
If you love the idea of stocknear and want to support our mission you can help us in two ways:
|
||||
|
||||
- Become a [Pro Member](https://stocknear.com/pricing) of stocknear to get unlimited feature access to enjoy the platform to the fullest.
|
||||
- You can donate money via [Ko-fi](https://ko-fi.com/stocknear) to help us pay the servers & data providers to keep everything running!
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
}
|
||||
|
||||
2035
package-lock.json
generated
2035
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -98,6 +98,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.556.0",
|
||||
"@sentry/sveltekit": "^8.30.0",
|
||||
"greeks": "^1.0.0",
|
||||
"html2canvas": "^1.4.1",
|
||||
"https": "^1.0.0",
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
import { defineConfig, devices } from '@playwright/test'; // import devices
|
||||
import { defineConfig, devices } from "@playwright/test"; // import devices
|
||||
|
||||
export default defineConfig({
|
||||
testDir: 'tests',
|
||||
testDir: "tests",
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
name: "chromium",
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
...devices["Desktop Chrome"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'safari',
|
||||
name: "safari",
|
||||
use: {
|
||||
...devices['Iphone 6'],
|
||||
...devices["Iphone 6"],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
|
||||
autoprefixer: {},
|
||||
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
131
src/app.css
131
src/app.css
@ -2,10 +2,6 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.table {
|
||||
@apply text-left text-sm rtl:text-right;
|
||||
:where(th, td) {
|
||||
@ -45,7 +41,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@layer utilities {
|
||||
.no-scrollbar {
|
||||
overflow-x: hidden;
|
||||
@ -54,14 +49,14 @@
|
||||
|
||||
/* Styles for WebKit browsers (Chrome, Safari, newer versions of Opera) */
|
||||
.no-scrollbar::-webkit-scrollbar {
|
||||
width: auto; /* Keep the width for vertical scrollbar */
|
||||
height: 0; /* Set height to 0 to hide horizontal scrollbar */
|
||||
width: auto; /* Keep the width for vertical scrollbar */
|
||||
height: 0; /* Set height to 0 to hide horizontal scrollbar */
|
||||
}
|
||||
|
||||
/* Styles for Firefox */
|
||||
.no-scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: auto transparent; /* vertical scrollbar color, then track color */
|
||||
scrollbar-color: auto transparent; /* vertical scrollbar color, then track color */
|
||||
}
|
||||
|
||||
/* Styles for Internet Explorer and Edge */
|
||||
@ -69,84 +64,86 @@
|
||||
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||
}
|
||||
|
||||
.shake-ticker:hover img {
|
||||
animation-name: shake;
|
||||
animation-duration: 0.5s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
.shake-ticker:hover img {
|
||||
animation-name: shake;
|
||||
animation-duration: 0.5s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: ease-in-out;
|
||||
@keyframes shake {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
|
||||
@keyframes shake {
|
||||
0% { transform: rotate(0deg); }
|
||||
25% { transform: rotate(10deg); }
|
||||
50% { transform: rotate(0deg); }
|
||||
75% { transform: rotate(-10deg); }
|
||||
100% { transform: rotate(0deg); }
|
||||
25% {
|
||||
transform: rotate(10deg);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
75% {
|
||||
transform: rotate(-10deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.loader,
|
||||
.loader:before,
|
||||
.loader:after {
|
||||
border-radius: 50%;
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
-webkit-animation: load7 0.8s infinite ease-in-out;
|
||||
animation: load7 0.8s infinite ease-in-out;
|
||||
border-radius: 50%;
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
-webkit-animation: load7 0.8s infinite ease-in-out;
|
||||
animation: load7 0.8s infinite ease-in-out;
|
||||
}
|
||||
.loader {
|
||||
color: #ffffff;
|
||||
font-size: 10px;
|
||||
margin: 80px auto;
|
||||
position: relative;
|
||||
text-indent: -9999em;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
-webkit-animation-delay: -0.16s;
|
||||
animation-delay: -0.16s;
|
||||
color: #ffffff;
|
||||
font-size: 10px;
|
||||
margin: 80px auto;
|
||||
position: relative;
|
||||
text-indent: -9999em;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
-webkit-animation-delay: -0.16s;
|
||||
animation-delay: -0.16s;
|
||||
}
|
||||
.loader:before,
|
||||
.loader:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
.loader:before {
|
||||
left: -3.5em;
|
||||
-webkit-animation-delay: -0.32s;
|
||||
animation-delay: -0.32s;
|
||||
left: -3.5em;
|
||||
-webkit-animation-delay: -0.32s;
|
||||
animation-delay: -0.32s;
|
||||
}
|
||||
.loader:after {
|
||||
left: 3.5em;
|
||||
left: 3.5em;
|
||||
}
|
||||
@-webkit-keyframes load7 {
|
||||
0%,
|
||||
80%,
|
||||
100% {
|
||||
box-shadow: 0 2.5em 0 -1.3em;
|
||||
}
|
||||
40% {
|
||||
box-shadow: 0 2.5em 0 0;
|
||||
}
|
||||
0%,
|
||||
80%,
|
||||
100% {
|
||||
box-shadow: 0 2.5em 0 -1.3em;
|
||||
}
|
||||
40% {
|
||||
box-shadow: 0 2.5em 0 0;
|
||||
}
|
||||
}
|
||||
@keyframes load7 {
|
||||
0%,
|
||||
80%,
|
||||
100% {
|
||||
box-shadow: 0 2.5em 0 -1.3em;
|
||||
0%,
|
||||
80%,
|
||||
100% {
|
||||
box-shadow: 0 2.5em 0 -1.3em;
|
||||
}
|
||||
40% {
|
||||
box-shadow: 0 2.5em 0 0;
|
||||
}
|
||||
}
|
||||
40% {
|
||||
box-shadow: 0 2.5em 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
src/app.d.ts
vendored
9
src/app.d.ts
vendored
@ -2,13 +2,12 @@
|
||||
// for information about these interfaces
|
||||
// and what to do when importing types
|
||||
declare namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface Platform {}
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface Platform {}
|
||||
}
|
||||
|
||||
|
||||
// src/app.d.ts
|
||||
/*
|
||||
import PocketBase from "pocketbase";
|
||||
|
||||
33
src/app.html
33
src/app.html
@ -1,22 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en" class="bg-[#09090B]">
|
||||
<head>
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<link rel="manifest" href="%sveltekit.assets%/manifest.json" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<link rel="manifest" href="%sveltekit.assets%/manifest.json" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
%sveltekit.head%
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- Global background color -->
|
||||
<body data-sveltekit-preload-data="hover" class="bg-[#09090B] overflow-x-hidden">
|
||||
<div>%sveltekit.body%</div>
|
||||
</body>
|
||||
<!-- Global background color -->
|
||||
<body
|
||||
data-sveltekit-preload-data="hover"
|
||||
class="bg-[#09090B] overflow-x-hidden"
|
||||
>
|
||||
<div>%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -69,4 +69,3 @@
|
||||
--radius: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
11
src/hooks.client.js
Normal file
11
src/hooks.client.js
Normal file
@ -0,0 +1,11 @@
|
||||
import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
||||
import * as Sentry from "@sentry/sveltekit";
|
||||
|
||||
Sentry.init({
|
||||
dsn: import.meta.env.VITE_SENTRY,
|
||||
|
||||
tracesSampleRate: 1.0,
|
||||
});
|
||||
|
||||
// If you have a custom error handler, pass it to `handleErrorWithSentry`
|
||||
export const handleError = handleErrorWithSentry();
|
||||
@ -1,75 +1,86 @@
|
||||
import { sequence } from "@sveltejs/kit/hooks";
|
||||
import * as Sentry from "@sentry/sveltekit";
|
||||
import PocketBase from "pocketbase";
|
||||
import { serializeNonPOJOs } from "$lib/utils";
|
||||
|
||||
export const handle = async ({ event, resolve }) => {
|
||||
// Use optional chaining and nullish coalescing for safer property access
|
||||
const regionHeader =
|
||||
event?.request?.headers?.get("x-vercel-id") ??
|
||||
"fra1::fra1::8t4xg-1700258428633-157d82fdfcc7";
|
||||
Sentry.init({
|
||||
dsn: import.meta.env.VITE_SENTRY,
|
||||
tracesSampleRate: 1,
|
||||
});
|
||||
|
||||
const ip =
|
||||
event.request.headers.get("x-forwarded-for") ||
|
||||
event.request.headers.get("remote-address");
|
||||
export const handle = sequence(
|
||||
Sentry.sentryHandle(),
|
||||
async ({ event, resolve }) => {
|
||||
// Use optional chaining and nullish coalescing for safer property access
|
||||
const regionHeader =
|
||||
event?.request?.headers?.get("x-vercel-id") ??
|
||||
"fra1::fra1::8t4xg-1700258428633-157d82fdfcc7";
|
||||
|
||||
let isUS = false;
|
||||
const ip =
|
||||
event.request.headers.get("x-forwarded-for") ||
|
||||
event.request.headers.get("remote-address");
|
||||
|
||||
if (ip) {
|
||||
const geoResponse = await fetch(`https://ipinfo.io/${ip}/geo`);
|
||||
const geoData = await geoResponse.json();
|
||||
if (geoData.country === "US") {
|
||||
isUS = true;
|
||||
//console.log("yelllo", geoData);
|
||||
let isUS = false;
|
||||
|
||||
if (ip) {
|
||||
const geoResponse = await fetch(`https://ipinfo.io/${ip}/geo`);
|
||||
const geoData = await geoResponse.json();
|
||||
if (geoData.country === "US") {
|
||||
isUS = true;
|
||||
//console.log("yelllo", geoData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use a ternary operator instead of the logical OR for better compatibility
|
||||
const pbURL = isUS
|
||||
? import.meta.env.VITE_USEAST_POCKETBASE_URL
|
||||
: import.meta.env.VITE_EU_POCKETBASE_URL;
|
||||
const apiURL = isUS
|
||||
? import.meta.env.VITE_USEAST_API_URL
|
||||
: import.meta.env.VITE_EU_API_URL;
|
||||
const fastifyURL = isUS
|
||||
? import.meta.env.VITE_USEAST_FASTIFY_URL
|
||||
: import.meta.env.VITE_EU_FASTIFY_URL;
|
||||
const wsURL = isUS
|
||||
? import.meta.env.VITE_USEAST_WS_URL
|
||||
: import.meta.env.VITE_EU_WS_URL;
|
||||
// Use a ternary operator instead of the logical OR for better compatibility
|
||||
const pbURL = isUS
|
||||
? import.meta.env.VITE_USEAST_POCKETBASE_URL
|
||||
: import.meta.env.VITE_EU_POCKETBASE_URL;
|
||||
const apiURL = isUS
|
||||
? import.meta.env.VITE_USEAST_API_URL
|
||||
: import.meta.env.VITE_EU_API_URL;
|
||||
const fastifyURL = isUS
|
||||
? import.meta.env.VITE_USEAST_FASTIFY_URL
|
||||
: import.meta.env.VITE_EU_FASTIFY_URL;
|
||||
const wsURL = isUS
|
||||
? import.meta.env.VITE_USEAST_WS_URL
|
||||
: import.meta.env.VITE_EU_WS_URL;
|
||||
|
||||
event.locals = {
|
||||
region: decodeURIComponent(regionHeader),
|
||||
pb: new PocketBase(pbURL),
|
||||
apiURL,
|
||||
fastifyURL,
|
||||
wsURL,
|
||||
apiKey: import.meta.env.VITE_STOCKNEAR_API_KEY,
|
||||
};
|
||||
event.locals = {
|
||||
region: decodeURIComponent(regionHeader),
|
||||
pb: new PocketBase(pbURL),
|
||||
apiURL,
|
||||
fastifyURL,
|
||||
wsURL,
|
||||
apiKey: import.meta.env.VITE_STOCKNEAR_API_KEY,
|
||||
};
|
||||
|
||||
const authCookie = event?.request?.headers?.get("cookie") || "";
|
||||
event.locals.pb.authStore.loadFromCookie(authCookie);
|
||||
const authCookie = event?.request?.headers?.get("cookie") || "";
|
||||
event.locals.pb.authStore.loadFromCookie(authCookie);
|
||||
|
||||
if (event?.locals?.pb?.authStore?.isValid) {
|
||||
try {
|
||||
await event.locals.pb.collection("users").authRefresh();
|
||||
event.locals.user = serializeNonPOJOs(event.locals.pb.authStore.model);
|
||||
} catch (_) {
|
||||
event.locals.pb.authStore.clear();
|
||||
event.locals.user = undefined;
|
||||
if (event?.locals?.pb?.authStore?.isValid) {
|
||||
try {
|
||||
await event.locals.pb.collection("users").authRefresh();
|
||||
event.locals.user = serializeNonPOJOs(event.locals.pb.authStore.model);
|
||||
} catch (_) {
|
||||
event.locals.pb.authStore.clear();
|
||||
event.locals.user = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const response = await resolve(event);
|
||||
|
||||
// Use a more compatible way to set the cookie
|
||||
const cookieString = event.locals.pb.authStore.exportToCookie({
|
||||
httpOnly: true,
|
||||
path: "/",
|
||||
sameSite: "lax",
|
||||
secure: true,
|
||||
maxAge: 60 * 60 * 24 * 365,
|
||||
});
|
||||
|
||||
response.headers.append("set-cookie", cookieString);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
const response = await resolve(event);
|
||||
|
||||
// Use a more compatible way to set the cookie
|
||||
const cookieString = event.locals.pb.authStore.exportToCookie({
|
||||
httpOnly: true,
|
||||
path: "/",
|
||||
sameSite: "lax",
|
||||
secure: true,
|
||||
maxAge: 60 * 60 * 24 * 365,
|
||||
});
|
||||
|
||||
response.headers.append("set-cookie", cookieString);
|
||||
|
||||
return response;
|
||||
};
|
||||
);
|
||||
export const handleError = Sentry.handleErrorWithSentry();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
describe('sum test', () => {
|
||||
it('adds 1 + 2 to equal 3', () => {
|
||||
expect(1 + 2).toBe(3);
|
||||
});
|
||||
describe("sum test", () => {
|
||||
it("adds 1 + 2 to equal 3", () => {
|
||||
expect(1 + 2).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,186 +1,207 @@
|
||||
.driver-active .driver-overlay, .driver-active * {
|
||||
pointer-events: none;
|
||||
.driver-active .driver-overlay,
|
||||
.driver-active * {
|
||||
pointer-events: none;
|
||||
}
|
||||
.driver-active .driver-active-element, .driver-active .driver-active-element *, .driver-popover, .driver-popover * {
|
||||
pointer-events: auto;
|
||||
.driver-active .driver-active-element,
|
||||
.driver-active .driver-active-element *,
|
||||
.driver-popover,
|
||||
.driver-popover * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
@keyframes animate-fade-in {
|
||||
0% {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}.driver-fade .driver-overlay {
|
||||
animation: animate-fade-in .2s ease-in-out;
|
||||
.driver-fade .driver-overlay {
|
||||
animation: animate-fade-in 0.2s ease-in-out;
|
||||
}
|
||||
.driver-fade .driver-popover {
|
||||
animation: animate-fade-in .2s;
|
||||
animation: animate-fade-in 0.2s;
|
||||
}
|
||||
.driver-popover {
|
||||
all: unset;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
border-radius: 0px;
|
||||
min-width: 250px;
|
||||
max-width: 500px;
|
||||
box-shadow: 0 1px 10px #0006;
|
||||
z-index: 1000000000;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background-color: #202327;
|
||||
all: unset;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
border-radius: 0px;
|
||||
min-width: 250px;
|
||||
max-width: 500px;
|
||||
box-shadow: 0 1px 10px #0006;
|
||||
z-index: 1000000000;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background-color: #202327;
|
||||
}
|
||||
.driver-popover * {
|
||||
font-family: Helvetica Neue, Inter, ui-sans-serif, "Apple Color Emoji", Helvetica, Arial, sans-serif;
|
||||
font-family:
|
||||
Helvetica Neue,
|
||||
Inter,
|
||||
ui-sans-serif,
|
||||
"Apple Color Emoji",
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
}
|
||||
.driver-popover-title {
|
||||
font: 19px/normal sans-serif;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
position: relative;
|
||||
line-height: 1.5;
|
||||
zoom: 1;
|
||||
margin: 0;
|
||||
font: 19px / normal sans-serif;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
position: relative;
|
||||
line-height: 1.5;
|
||||
zoom: 1;
|
||||
margin: 0;
|
||||
}
|
||||
.driver-popover-close-btn {
|
||||
all: unset;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 32px;
|
||||
height: 28px;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #d2d2d2;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
transition: color;
|
||||
transition-duration: .2s;
|
||||
all: unset;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 32px;
|
||||
height: 28px;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #d2d2d2;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
transition: color;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
.driver-popover-close-btn:hover, .driver-popover-close-btn:focus {
|
||||
color: #2d2d2d;
|
||||
.driver-popover-close-btn:hover,
|
||||
.driver-popover-close-btn:focus {
|
||||
color: #2d2d2d;
|
||||
}
|
||||
.driver-popover-title[style*=block]+.driver-popover-description {
|
||||
margin-top: 5px;
|
||||
.driver-popover-title[style*="block"] + .driver-popover-description {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.driver-popover-description {
|
||||
margin-bottom: 0;
|
||||
font: 16px/normal sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
zoom: 1;
|
||||
margin-bottom: 0;
|
||||
font: 16px / normal sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
zoom: 1;
|
||||
}
|
||||
.driver-popover-footer {
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
zoom: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 40px;
|
||||
text-align: right;
|
||||
zoom: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.driver-popover-progress-text {
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
zoom: 1;
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
zoom: 1;
|
||||
}
|
||||
.driver-popover-footer button {
|
||||
all: unset;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 20px;
|
||||
text-decoration: none;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
background-color: #fff;
|
||||
color: #2d2d2d;
|
||||
font: 14px/normal sans-serif;
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
zoom: 1;
|
||||
line-height: 1.3;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
all: unset;
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 20px;
|
||||
text-decoration: none;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
background-color: #fff;
|
||||
color: #2d2d2d;
|
||||
font: 14px / normal sans-serif;
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
zoom: 1;
|
||||
line-height: 1.3;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.driver-popover-footer .driver-popover-btn-disabled {
|
||||
opacity: .5;
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
:not(body):has(>.driver-active-element) {
|
||||
overflow: hidden!important;
|
||||
:not(body):has(> .driver-active-element) {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.driver-no-interaction, .driver-no-interaction * {
|
||||
pointer-events: none!important;
|
||||
.driver-no-interaction,
|
||||
.driver-no-interaction * {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
.driver-popover-footer button:hover, .driver-popover-footer button:focus {
|
||||
background-color: #f7f7f7;
|
||||
.driver-popover-footer button:hover,
|
||||
.driver-popover-footer button:focus {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.driver-popover-navigation-btns {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: flex-end;
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.driver-popover-navigation-btns button+button {
|
||||
margin-left: 4px;
|
||||
.driver-popover-navigation-btns button + button {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.driver-popover-arrow {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border: 5px solid #fff;
|
||||
content: "";
|
||||
position: absolute;
|
||||
border: 5px solid #fff;
|
||||
}
|
||||
.driver-popover-arrow-side-over {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
.driver-popover-arrow-side-left {
|
||||
left: 100%;
|
||||
border-right-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-top-color: transparent;
|
||||
left: 100%;
|
||||
border-right-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
.driver-popover-arrow-side-right {
|
||||
right: 100%;
|
||||
border-left-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-top-color: transparent;
|
||||
right: 100%;
|
||||
border-left-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
.driver-popover-arrow-side-top {
|
||||
top: 100%;
|
||||
border-right-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-left-color: transparent;
|
||||
top: 100%;
|
||||
border-right-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
.driver-popover-arrow-side-bottom {
|
||||
bottom: 100%;
|
||||
border-left-color: transparent;
|
||||
border-top-color: transparent;
|
||||
border-right-color: transparent;
|
||||
bottom: 100%;
|
||||
border-left-color: transparent;
|
||||
border-top-color: transparent;
|
||||
border-right-color: transparent;
|
||||
}
|
||||
.driver-popover-arrow-side-center {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
.driver-popover-arrow-side-left.driver-popover-arrow-align-start, .driver-popover-arrow-side-right.driver-popover-arrow-align-start {
|
||||
top: 15px;
|
||||
.driver-popover-arrow-side-left.driver-popover-arrow-align-start,
|
||||
.driver-popover-arrow-side-right.driver-popover-arrow-align-start {
|
||||
top: 15px;
|
||||
}
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-start, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-start {
|
||||
left: 15px;
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-start,
|
||||
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-start {
|
||||
left: 15px;
|
||||
}
|
||||
.driver-popover-arrow-align-end.driver-popover-arrow-side-left, .driver-popover-arrow-align-end.driver-popover-arrow-side-right {
|
||||
bottom: 15px;
|
||||
.driver-popover-arrow-align-end.driver-popover-arrow-side-left,
|
||||
.driver-popover-arrow-align-end.driver-popover-arrow-side-right {
|
||||
bottom: 15px;
|
||||
}
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-end, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-end {
|
||||
right: 15px;
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-end,
|
||||
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-end {
|
||||
right: 15px;
|
||||
}
|
||||
.driver-popover-arrow-side-left.driver-popover-arrow-align-center, .driver-popover-arrow-side-right.driver-popover-arrow-align-center {
|
||||
top: 50%;
|
||||
margin-top: -5px;
|
||||
.driver-popover-arrow-side-left.driver-popover-arrow-align-center,
|
||||
.driver-popover-arrow-side-right.driver-popover-arrow-align-center {
|
||||
top: 50%;
|
||||
margin-top: -5px;
|
||||
}
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-center, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-center {
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-center,
|
||||
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-center {
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
}
|
||||
.driver-popover-arrow-none {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
import Info from './Info.svelte';
|
||||
import Info from "./Info.svelte";
|
||||
|
||||
export {Info};
|
||||
export { Info };
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -5,13 +5,13 @@ import Trigger from "./accordion-trigger.svelte";
|
||||
const Root = AccordionPrimitive.Root;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Content,
|
||||
Item,
|
||||
Trigger,
|
||||
//
|
||||
Root as Accordion,
|
||||
Content as AccordionContent,
|
||||
Item as AccordionItem,
|
||||
Trigger as AccordionTrigger,
|
||||
Root,
|
||||
Content,
|
||||
Item,
|
||||
Trigger,
|
||||
//
|
||||
Root as Accordion,
|
||||
Content as AccordionContent,
|
||||
Item as AccordionItem,
|
||||
Trigger as AccordionTrigger,
|
||||
};
|
||||
@ -5,29 +5,29 @@ import Description from "./alert-description.svelte";
|
||||
import Title from "./alert-title.svelte";
|
||||
|
||||
export const alertVariants = tv({
|
||||
base: "relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
||||
base: "relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
||||
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-background text-foreground",
|
||||
destructive:
|
||||
"border-destructive/50 text-destructive text-destructive dark:border-destructive [&>svg]:text-destructive",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-background text-foreground",
|
||||
destructive:
|
||||
"border-destructive/50 text-destructive text-destructive dark:border-destructive [&>svg]:text-destructive",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
});
|
||||
|
||||
export type Variant = VariantProps<typeof alertVariants>["variant"];
|
||||
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
||||
|
||||
export {
|
||||
Root,
|
||||
Description,
|
||||
Title,
|
||||
//
|
||||
Root as Alert,
|
||||
Description as AlertDescription,
|
||||
Title as AlertTitle,
|
||||
Root,
|
||||
Description,
|
||||
Title,
|
||||
//
|
||||
Root as Alert,
|
||||
Description as AlertDescription,
|
||||
Title as AlertTitle,
|
||||
};
|
||||
@ -3,11 +3,11 @@ import Image from "./avatar-image.svelte";
|
||||
import Fallback from "./avatar-fallback.svelte";
|
||||
|
||||
export {
|
||||
Root,
|
||||
Image,
|
||||
Fallback,
|
||||
//
|
||||
Root as Avatar,
|
||||
Image as AvatarImage,
|
||||
Fallback as AvatarFallback,
|
||||
Root,
|
||||
Image,
|
||||
Fallback,
|
||||
//
|
||||
Root as Avatar,
|
||||
Image as AvatarImage,
|
||||
Fallback as AvatarFallback,
|
||||
};
|
||||
@ -2,20 +2,21 @@ import { type VariantProps, tv } from "tailwind-variants";
|
||||
export { default as Badge } from "./badge.svelte";
|
||||
|
||||
export const badgeVariants = tv({
|
||||
base: "inline-flex select-none items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
||||
variants: {
|
||||
variant: {
|
||||
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
||||
secondary:
|
||||
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
destructive:
|
||||
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
||||
outline: "text-foreground",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
base: "inline-flex select-none items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
||||
secondary:
|
||||
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
destructive:
|
||||
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
||||
outline: "text-foreground",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
});
|
||||
|
||||
export type Variant = VariantProps<typeof badgeVariants>["variant"];
|
||||
@ -13,18 +13,18 @@ import NextButton from "./calendar-next-button.svelte";
|
||||
import PrevButton from "./calendar-prev-button.svelte";
|
||||
|
||||
export {
|
||||
Day,
|
||||
Cell,
|
||||
Grid,
|
||||
Header,
|
||||
Months,
|
||||
GridRow,
|
||||
Heading,
|
||||
GridBody,
|
||||
GridHead,
|
||||
HeadCell,
|
||||
NextButton,
|
||||
PrevButton,
|
||||
//
|
||||
Root as Calendar,
|
||||
Day,
|
||||
Cell,
|
||||
Grid,
|
||||
Header,
|
||||
Months,
|
||||
GridRow,
|
||||
Heading,
|
||||
GridBody,
|
||||
GridHead,
|
||||
HeadCell,
|
||||
NextButton,
|
||||
PrevButton,
|
||||
//
|
||||
Root as Calendar,
|
||||
};
|
||||
|
||||
@ -6,19 +6,19 @@ import Header from "./card-header.svelte";
|
||||
import Title from "./card-title.svelte";
|
||||
|
||||
export {
|
||||
Root,
|
||||
Content,
|
||||
Description,
|
||||
Footer,
|
||||
Header,
|
||||
Title,
|
||||
//
|
||||
Root as Card,
|
||||
Content as CardContent,
|
||||
Description as CardDescription,
|
||||
Footer as CardFooter,
|
||||
Header as CardHeader,
|
||||
Title as CardTitle,
|
||||
Root,
|
||||
Content,
|
||||
Description,
|
||||
Footer,
|
||||
Header,
|
||||
Title,
|
||||
//
|
||||
Root as Card,
|
||||
Content as CardContent,
|
||||
Description as CardDescription,
|
||||
Footer as CardFooter,
|
||||
Header as CardHeader,
|
||||
Title as CardTitle,
|
||||
};
|
||||
|
||||
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
||||
@ -13,25 +13,25 @@ import Shortcut from "./command-shortcut.svelte";
|
||||
const Loading = CommandPrimitive.Loading;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Dialog,
|
||||
Empty,
|
||||
Group,
|
||||
Item,
|
||||
Input,
|
||||
List,
|
||||
Separator,
|
||||
Shortcut,
|
||||
Loading,
|
||||
//
|
||||
Root as Command,
|
||||
Dialog as CommandDialog,
|
||||
Empty as CommandEmpty,
|
||||
Group as CommandGroup,
|
||||
Item as CommandItem,
|
||||
Input as CommandInput,
|
||||
List as CommandList,
|
||||
Separator as CommandSeparator,
|
||||
Shortcut as CommandShortcut,
|
||||
Loading as CommandLoading,
|
||||
Root,
|
||||
Dialog,
|
||||
Empty,
|
||||
Group,
|
||||
Item,
|
||||
Input,
|
||||
List,
|
||||
Separator,
|
||||
Shortcut,
|
||||
Loading,
|
||||
//
|
||||
Root as Command,
|
||||
Dialog as CommandDialog,
|
||||
Empty as CommandEmpty,
|
||||
Group as CommandGroup,
|
||||
Item as CommandItem,
|
||||
Input as CommandInput,
|
||||
List as CommandList,
|
||||
Separator as CommandSeparator,
|
||||
Shortcut as CommandShortcut,
|
||||
Loading as CommandLoading,
|
||||
};
|
||||
@ -13,25 +13,25 @@ const Trigger = DialogPrimitive.Trigger;
|
||||
const Close = DialogPrimitive.Close;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Title,
|
||||
Portal,
|
||||
Footer,
|
||||
Header,
|
||||
Trigger,
|
||||
Overlay,
|
||||
Content,
|
||||
Description,
|
||||
Close,
|
||||
//
|
||||
Root as Dialog,
|
||||
Title as DialogTitle,
|
||||
Portal as DialogPortal,
|
||||
Footer as DialogFooter,
|
||||
Header as DialogHeader,
|
||||
Trigger as DialogTrigger,
|
||||
Overlay as DialogOverlay,
|
||||
Content as DialogContent,
|
||||
Description as DialogDescription,
|
||||
Close as DialogClose,
|
||||
Root,
|
||||
Title,
|
||||
Portal,
|
||||
Footer,
|
||||
Header,
|
||||
Trigger,
|
||||
Overlay,
|
||||
Content,
|
||||
Description,
|
||||
Close,
|
||||
//
|
||||
Root as Dialog,
|
||||
Title as DialogTitle,
|
||||
Portal as DialogPortal,
|
||||
Footer as DialogFooter,
|
||||
Header as DialogHeader,
|
||||
Trigger as DialogTrigger,
|
||||
Overlay as DialogOverlay,
|
||||
Content as DialogContent,
|
||||
Description as DialogDescription,
|
||||
Close as DialogClose,
|
||||
};
|
||||
@ -16,33 +16,33 @@ const Trigger = DropdownMenuPrimitive.Trigger;
|
||||
const Group = DropdownMenuPrimitive.Group;
|
||||
|
||||
export {
|
||||
Sub,
|
||||
Root,
|
||||
Item,
|
||||
Label,
|
||||
Group,
|
||||
Trigger,
|
||||
Content,
|
||||
Shortcut,
|
||||
Separator,
|
||||
RadioItem,
|
||||
SubContent,
|
||||
SubTrigger,
|
||||
RadioGroup,
|
||||
CheckboxItem,
|
||||
//
|
||||
Root as DropdownMenu,
|
||||
Sub as DropdownMenuSub,
|
||||
Item as DropdownMenuItem,
|
||||
Label as DropdownMenuLabel,
|
||||
Group as DropdownMenuGroup,
|
||||
Content as DropdownMenuContent,
|
||||
Trigger as DropdownMenuTrigger,
|
||||
Shortcut as DropdownMenuShortcut,
|
||||
RadioItem as DropdownMenuRadioItem,
|
||||
Separator as DropdownMenuSeparator,
|
||||
RadioGroup as DropdownMenuRadioGroup,
|
||||
SubContent as DropdownMenuSubContent,
|
||||
SubTrigger as DropdownMenuSubTrigger,
|
||||
CheckboxItem as DropdownMenuCheckboxItem,
|
||||
Sub,
|
||||
Root,
|
||||
Item,
|
||||
Label,
|
||||
Group,
|
||||
Trigger,
|
||||
Content,
|
||||
Shortcut,
|
||||
Separator,
|
||||
RadioItem,
|
||||
SubContent,
|
||||
SubTrigger,
|
||||
RadioGroup,
|
||||
CheckboxItem,
|
||||
//
|
||||
Root as DropdownMenu,
|
||||
Sub as DropdownMenuSub,
|
||||
Item as DropdownMenuItem,
|
||||
Label as DropdownMenuLabel,
|
||||
Group as DropdownMenuGroup,
|
||||
Content as DropdownMenuContent,
|
||||
Trigger as DropdownMenuTrigger,
|
||||
Shortcut as DropdownMenuShortcut,
|
||||
RadioItem as DropdownMenuRadioItem,
|
||||
Separator as DropdownMenuSeparator,
|
||||
RadioGroup as DropdownMenuRadioGroup,
|
||||
SubContent as DropdownMenuSubContent,
|
||||
SubTrigger as DropdownMenuSubTrigger,
|
||||
CheckboxItem as DropdownMenuCheckboxItem,
|
||||
};
|
||||
@ -1,29 +1,29 @@
|
||||
import Root from "./input.svelte";
|
||||
|
||||
export type FormInputEvent<T extends Event = Event> = T & {
|
||||
currentTarget: EventTarget & HTMLInputElement;
|
||||
currentTarget: EventTarget & HTMLInputElement;
|
||||
};
|
||||
export type InputEvents = {
|
||||
blur: FormInputEvent<FocusEvent>;
|
||||
change: FormInputEvent<Event>;
|
||||
click: FormInputEvent<MouseEvent>;
|
||||
focus: FormInputEvent<FocusEvent>;
|
||||
focusin: FormInputEvent<FocusEvent>;
|
||||
focusout: FormInputEvent<FocusEvent>;
|
||||
keydown: FormInputEvent<KeyboardEvent>;
|
||||
keypress: FormInputEvent<KeyboardEvent>;
|
||||
keyup: FormInputEvent<KeyboardEvent>;
|
||||
mouseover: FormInputEvent<MouseEvent>;
|
||||
mouseenter: FormInputEvent<MouseEvent>;
|
||||
mouseleave: FormInputEvent<MouseEvent>;
|
||||
mousemove: FormInputEvent<MouseEvent>;
|
||||
paste: FormInputEvent<ClipboardEvent>;
|
||||
input: FormInputEvent<InputEvent>;
|
||||
wheel: FormInputEvent<WheelEvent>;
|
||||
blur: FormInputEvent<FocusEvent>;
|
||||
change: FormInputEvent<Event>;
|
||||
click: FormInputEvent<MouseEvent>;
|
||||
focus: FormInputEvent<FocusEvent>;
|
||||
focusin: FormInputEvent<FocusEvent>;
|
||||
focusout: FormInputEvent<FocusEvent>;
|
||||
keydown: FormInputEvent<KeyboardEvent>;
|
||||
keypress: FormInputEvent<KeyboardEvent>;
|
||||
keyup: FormInputEvent<KeyboardEvent>;
|
||||
mouseover: FormInputEvent<MouseEvent>;
|
||||
mouseenter: FormInputEvent<MouseEvent>;
|
||||
mouseleave: FormInputEvent<MouseEvent>;
|
||||
mousemove: FormInputEvent<MouseEvent>;
|
||||
paste: FormInputEvent<ClipboardEvent>;
|
||||
input: FormInputEvent<InputEvent>;
|
||||
wheel: FormInputEvent<WheelEvent>;
|
||||
};
|
||||
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Input,
|
||||
Root,
|
||||
//
|
||||
Root as Input,
|
||||
};
|
||||
@ -5,13 +5,13 @@ const Trigger = PopoverPrimitive.Trigger;
|
||||
const Close = PopoverPrimitive.Close;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Content,
|
||||
Trigger,
|
||||
Close,
|
||||
//
|
||||
Root as Popover,
|
||||
Content as PopoverContent,
|
||||
Trigger as PopoverTrigger,
|
||||
Close as PopoverClose,
|
||||
Root,
|
||||
Content,
|
||||
Trigger,
|
||||
Close,
|
||||
//
|
||||
Root as Popover,
|
||||
Content as PopoverContent,
|
||||
Trigger as PopoverTrigger,
|
||||
Close as PopoverClose,
|
||||
};
|
||||
@ -1,7 +1,7 @@
|
||||
import Root from "./progress.svelte";
|
||||
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Progress,
|
||||
Root,
|
||||
//
|
||||
Root as Progress,
|
||||
};
|
||||
@ -12,23 +12,23 @@ const Input = SelectPrimitive.Input;
|
||||
const Value = SelectPrimitive.Value;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Group,
|
||||
Input,
|
||||
Label,
|
||||
Item,
|
||||
Value,
|
||||
Content,
|
||||
Trigger,
|
||||
Separator,
|
||||
//
|
||||
Root as Select,
|
||||
Group as SelectGroup,
|
||||
Input as SelectInput,
|
||||
Label as SelectLabel,
|
||||
Item as SelectItem,
|
||||
Value as SelectValue,
|
||||
Content as SelectContent,
|
||||
Trigger as SelectTrigger,
|
||||
Separator as SelectSeparator,
|
||||
Root,
|
||||
Group,
|
||||
Input,
|
||||
Label,
|
||||
Item,
|
||||
Value,
|
||||
Content,
|
||||
Trigger,
|
||||
Separator,
|
||||
//
|
||||
Root as Select,
|
||||
Group as SelectGroup,
|
||||
Input as SelectInput,
|
||||
Label as SelectLabel,
|
||||
Item as SelectItem,
|
||||
Value as SelectValue,
|
||||
Content as SelectContent,
|
||||
Trigger as SelectTrigger,
|
||||
Separator as SelectSeparator,
|
||||
};
|
||||
@ -14,93 +14,93 @@ const Close = SheetPrimitive.Close;
|
||||
const Trigger = SheetPrimitive.Trigger;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Close,
|
||||
Trigger,
|
||||
Portal,
|
||||
Overlay,
|
||||
Content,
|
||||
Header,
|
||||
Footer,
|
||||
Title,
|
||||
Description,
|
||||
//
|
||||
Root as Sheet,
|
||||
Close as SheetClose,
|
||||
Trigger as SheetTrigger,
|
||||
Portal as SheetPortal,
|
||||
Overlay as SheetOverlay,
|
||||
Content as SheetContent,
|
||||
Header as SheetHeader,
|
||||
Footer as SheetFooter,
|
||||
Title as SheetTitle,
|
||||
Description as SheetDescription,
|
||||
Root,
|
||||
Close,
|
||||
Trigger,
|
||||
Portal,
|
||||
Overlay,
|
||||
Content,
|
||||
Header,
|
||||
Footer,
|
||||
Title,
|
||||
Description,
|
||||
//
|
||||
Root as Sheet,
|
||||
Close as SheetClose,
|
||||
Trigger as SheetTrigger,
|
||||
Portal as SheetPortal,
|
||||
Overlay as SheetOverlay,
|
||||
Content as SheetContent,
|
||||
Header as SheetHeader,
|
||||
Footer as SheetFooter,
|
||||
Title as SheetTitle,
|
||||
Description as SheetDescription,
|
||||
};
|
||||
|
||||
export const sheetVariants = tv({
|
||||
base: "fixed z-50 gap-4 bg-background p-6 shadow-lg",
|
||||
variants: {
|
||||
side: {
|
||||
top: "inset-x-0 top-0 border-b",
|
||||
bottom: "inset-x-0 bottom-0 border-t",
|
||||
left: "inset-y-0 left-0 h-full w-3/4 sm:max-w-sm",
|
||||
right: "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
side: "right",
|
||||
},
|
||||
base: "fixed z-50 gap-4 bg-background p-6 shadow-lg",
|
||||
variants: {
|
||||
side: {
|
||||
top: "inset-x-0 top-0 border-b",
|
||||
bottom: "inset-x-0 bottom-0 border-t",
|
||||
left: "inset-y-0 left-0 h-full w-3/4 sm:max-w-sm",
|
||||
right: "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
side: "right",
|
||||
},
|
||||
});
|
||||
|
||||
export const sheetTransitions = {
|
||||
top: {
|
||||
in: {
|
||||
y: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
y: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
bottom: {
|
||||
in: {
|
||||
y: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
y: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
left: {
|
||||
in: {
|
||||
x: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
x: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
right: {
|
||||
in: {
|
||||
x: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
x: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
top: {
|
||||
in: {
|
||||
y: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
y: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
bottom: {
|
||||
in: {
|
||||
y: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
y: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
left: {
|
||||
in: {
|
||||
x: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
x: "-100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
right: {
|
||||
in: {
|
||||
x: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
out: {
|
||||
x: "100%",
|
||||
duration: 100,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export type Side = VariantProps<typeof sheetVariants>["side"];
|
||||
@ -8,21 +8,21 @@ import Header from "./table-header.svelte";
|
||||
import Row from "./table-row.svelte";
|
||||
|
||||
export {
|
||||
Root,
|
||||
Body,
|
||||
Caption,
|
||||
Cell,
|
||||
Footer,
|
||||
Head,
|
||||
Header,
|
||||
Row,
|
||||
//
|
||||
Root as Table,
|
||||
Body as TableBody,
|
||||
Caption as TableCaption,
|
||||
Cell as TableCell,
|
||||
Footer as TableFooter,
|
||||
Head as TableHead,
|
||||
Header as TableHeader,
|
||||
Row as TableRow,
|
||||
Root,
|
||||
Body,
|
||||
Caption,
|
||||
Cell,
|
||||
Footer,
|
||||
Head,
|
||||
Header,
|
||||
Row,
|
||||
//
|
||||
Root as Table,
|
||||
Body as TableBody,
|
||||
Caption as TableCaption,
|
||||
Cell as TableCell,
|
||||
Footer as TableFooter,
|
||||
Head as TableHead,
|
||||
Header as TableHeader,
|
||||
Row as TableRow,
|
||||
};
|
||||
@ -6,13 +6,13 @@ import Trigger from "./tabs-trigger.svelte";
|
||||
const Root = TabsPrimitive.Root;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Content,
|
||||
List,
|
||||
Trigger,
|
||||
//
|
||||
Root as Tabs,
|
||||
Content as TabsContent,
|
||||
List as TabsList,
|
||||
Trigger as TabsTrigger,
|
||||
Root,
|
||||
Content,
|
||||
List,
|
||||
Trigger,
|
||||
//
|
||||
Root as Tabs,
|
||||
Content as TabsContent,
|
||||
List as TabsList,
|
||||
Trigger as TabsTrigger,
|
||||
};
|
||||
@ -5,11 +5,11 @@ const Root = TooltipPrimitive.Root;
|
||||
const Trigger = TooltipPrimitive.Trigger;
|
||||
|
||||
export {
|
||||
Root,
|
||||
Trigger,
|
||||
Content,
|
||||
//
|
||||
Root as Tooltip,
|
||||
Content as TooltipContent,
|
||||
Trigger as TooltipTrigger,
|
||||
Root,
|
||||
Trigger,
|
||||
Content,
|
||||
//
|
||||
Root as Tooltip,
|
||||
Content as TooltipContent,
|
||||
Trigger as TooltipTrigger,
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
363
src/lib/dist/tinymce/icons/default/icons.min.js
vendored
363
src/lib/dist/tinymce/icons/default/icons.min.js
vendored
File diff suppressed because one or more lines are too long
6275
src/lib/dist/tinymce/models/dom/model.min.js
vendored
6275
src/lib/dist/tinymce/models/dom/model.min.js
vendored
File diff suppressed because one or more lines are too long
159
src/lib/dist/tinymce/plugins/anchor/plugin.min.js
vendored
159
src/lib/dist/tinymce/plugins/anchor/plugin.min.js
vendored
@ -1,4 +1,161 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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)}},u=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",o),o(),()=>{e.off("NodeChange",o)}};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=>{const o=e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind,n=u(e)(t);return()=>{o(),n()}}}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t,onSetup:u(e)})})(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)}))}))}();
|
||||
!(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);
|
||||
}
|
||||
},
|
||||
u = (e) => (t) => {
|
||||
const o = () => {
|
||||
t.setEnabled(e.selection.isEditable());
|
||||
};
|
||||
return (
|
||||
e.on("NodeChange", o),
|
||||
o(),
|
||||
() => {
|
||||
e.off("NodeChange", o);
|
||||
}
|
||||
);
|
||||
};
|
||||
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) => {
|
||||
const o = e.selection.selectorChangedWithUnbind(
|
||||
"a:not([href])",
|
||||
t.setActive,
|
||||
).unbind,
|
||||
n = u(e)(t);
|
||||
return () => {
|
||||
o(), n();
|
||||
};
|
||||
},
|
||||
}),
|
||||
e.ui.registry.addMenuItem("anchor", {
|
||||
icon: "bookmark",
|
||||
text: "Anchor...",
|
||||
onAction: t,
|
||||
onSetup: u(e),
|
||||
});
|
||||
})(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);
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
172
src/lib/dist/tinymce/plugins/autolink/plugin.min.js
vendored
172
src/lib/dist/tinymce/plugins/autolink/plugin.min.js
vendored
@ -1,4 +1,174 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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),w=null!==(o=i.getParent(p,i.isBlock))&&void 0!==o?o:i.getRoot(),h=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}),w);if(!h)return null;let v=h.container;const _=k.backwards(h.container,h.offset,((e,t)=>{v=e;const n=g(e.data,t,f);return-1===n?n:n+1}),w),A=i.createRng();_?A.setStart(_.container,_.offset):A.setStart(v,0),A.setEnd(h.container,h.offset);const C=A.toString().replace(/\uFEFF/g,"").match(s);if(C){let t=C[0];return $="www.",(b=t).length>=4&&b.substr(0,4)===$?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)}))}();
|
||||
!(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),
|
||||
w =
|
||||
null !== (o = i.getParent(p, i.isBlock)) && void 0 !== o
|
||||
? o
|
||||
: i.getRoot(),
|
||||
h = 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;
|
||||
},
|
||||
w,
|
||||
);
|
||||
if (!h) return null;
|
||||
let v = h.container;
|
||||
const _ = k.backwards(
|
||||
h.container,
|
||||
h.offset,
|
||||
(e, t) => {
|
||||
v = e;
|
||||
const n = g(e.data, t, f);
|
||||
return -1 === n ? n : n + 1;
|
||||
},
|
||||
w,
|
||||
),
|
||||
A = i.createRng();
|
||||
_ ? A.setStart(_.container, _.offset) : A.setStart(v, 0),
|
||||
A.setEnd(h.container, h.offset);
|
||||
const C = A.toString()
|
||||
.replace(/\uFEFF/g, "")
|
||||
.match(s);
|
||||
if (C) {
|
||||
let t = C[0];
|
||||
return (
|
||||
($ = "www."),
|
||||
(b = t).length >= 4 && b.substr(0, 4) === $
|
||||
? (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);
|
||||
});
|
||||
})();
|
||||
|
||||
@ -1,4 +1,138 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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)}}))}();
|
||||
!(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);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
189
src/lib/dist/tinymce/plugins/autosave/plugin.min.js
vendored
189
src/lib/dist/tinymce/plugins/autosave/plugin.min.js
vendored
@ -1,4 +1,191 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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))))}();
|
||||
!(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)
|
||||
),
|
||||
);
|
||||
})();
|
||||
|
||||
54
src/lib/dist/tinymce/plugins/code/plugin.min.js
vendored
54
src/lib/dist/tinymce/plugins/code/plugin.min.js
vendored
@ -1,4 +1,56 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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),{})))}();
|
||||
!(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),
|
||||
{}
|
||||
),
|
||||
);
|
||||
})();
|
||||
|
||||
2272
src/lib/dist/tinymce/plugins/codesample/plugin.min.js
vendored
2272
src/lib/dist/tinymce/plugins/codesample/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,285 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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),y=m(11),p=(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),b=t=>d(t.dom.host),N=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 y(o=e)&&n(o.dom.host)?a.some(e):a.none();var o})(d(e)).fold((()=>o.body.contains(e)),(r=N,i=b,t=>r(i(t))));var r,i},S=t=>"rtl"===((t,e)=>{const o=t.dom,r=window.getComputedStyle(o).getPropertyValue(e);return""!==r||N(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),E=("li",t=>g(t)&&"li"===t.dom.nodeName.toLowerCase());const T=(t,e,n)=>{u(e,(e=>{const c=d(e),m=E(c),f=((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})(c,m);var v;(v=f,(t=>a.from(t.dom.parentNode).map(d))(v).filter(g)).each((e=>{if(t.setStyle(f.dom,"direction",null),S(e)===n?p(f,"dir"):((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)})(f,"dir",n),S(f)!==n&&t.setStyle(f.dom,"direction",n),m){const e=A(f,"li[dir],li[style]");u(e,(e=>{p(e,"dir"),t.setStyle(e.dom,"direction",null)}))}}))}))},C=(t,e)=>{t.selection.isEditable()&&(T(t.dom,t.selection.getSelectedBlocks(),e),t.nodeChanged())},D=(t,e)=>o=>{const r=r=>{const n=d(r.element);o.setActive(S(n)===e),o.setEnabled(t.selection.isEditable())};return t.on("NodeChange",r),o.setEnabled(t.selection.isEditable()),()=>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)}))}();
|
||||
!(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),
|
||||
y = m(11),
|
||||
p = (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)),
|
||||
b = (t) => d(t.dom.host),
|
||||
N = (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 y((o = e)) && n(o.dom.host) ? a.some(e) : a.none();
|
||||
var o;
|
||||
})(d(e)).fold(
|
||||
() => o.body.contains(e),
|
||||
((r = N), (i = b), (t) => r(i(t))),
|
||||
);
|
||||
var r, i;
|
||||
},
|
||||
S = (t) =>
|
||||
"rtl" ===
|
||||
((t, e) => {
|
||||
const o = t.dom,
|
||||
r = window.getComputedStyle(o).getPropertyValue(e);
|
||||
return "" !== r || N(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),
|
||||
E = ("li", (t) => g(t) && "li" === t.dom.nodeName.toLowerCase());
|
||||
const T = (t, e, n) => {
|
||||
u(e, (e) => {
|
||||
const c = d(e),
|
||||
m = E(c),
|
||||
f = ((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;
|
||||
})(c, m);
|
||||
var v;
|
||||
((v = f), ((t) => a.from(t.dom.parentNode).map(d))(v).filter(g)).each(
|
||||
(e) => {
|
||||
if (
|
||||
(t.setStyle(f.dom, "direction", null),
|
||||
S(e) === n
|
||||
? p(f, "dir")
|
||||
: ((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);
|
||||
})(f, "dir", n),
|
||||
S(f) !== n && t.setStyle(f.dom, "direction", n),
|
||||
m)
|
||||
) {
|
||||
const e = A(f, "li[dir],li[style]");
|
||||
u(e, (e) => {
|
||||
p(e, "dir"), t.setStyle(e.dom, "direction", null);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
C = (t, e) => {
|
||||
t.selection.isEditable() &&
|
||||
(T(t.dom, t.selection.getSelectedBlocks(), e), t.nodeChanged());
|
||||
},
|
||||
D = (t, e) => (o) => {
|
||||
const r = (r) => {
|
||||
const n = d(r.element);
|
||||
o.setActive(S(n) === e), o.setEnabled(t.selection.isEditable());
|
||||
};
|
||||
return (
|
||||
t.on("NodeChange", r),
|
||||
o.setEnabled(t.selection.isEditable()),
|
||||
() => 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);
|
||||
});
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
1172
src/lib/dist/tinymce/plugins/image/plugin.min.js
vendored
1172
src/lib/dist/tinymce/plugins/image/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
261
src/lib/dist/tinymce/plugins/importcss/plugin.min.js
vendored
261
src/lib/dist/tinymce/plugins/importcss/plugin.min.js
vendored
@ -1,4 +1,263 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!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))))}();
|
||||
!(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)
|
||||
),
|
||||
);
|
||||
})();
|
||||
|
||||
@ -1,4 +1,158 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),a=t("insertdatetime_dateformat"),n=t("insertdatetime_timeformat"),r=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 n;n=/%[HMSIp]/.test(t)?d(e,"%Y-%m-%dT%H:%M"):d(e,"%Y-%m-%d");const r=e.dom.getParent(e.selection.getStart(),"time");r?((e,t,a,n)=>{const r=e.dom.create("time",{datetime:a},n);e.dom.replace(r,t),e.selection.select(r,!0),e.selection.collapse(!1)})(e,r,n,a):e.insertContent('<time datetime="'+n+'">'+a+"</time>")}else e.insertContent(d(e,t))};var p=tinymce.util.Tools.resolve("tinymce.util.Tools");const g=e=>t=>{const a=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",a),a(),()=>{e.off("NodeChange",a)}};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,n)=>{u(e,null!=n?n:a(e))})),e.addCommand("mceInsertTime",((t,a)=>{u(e,null!=a?a:n(e))}))})(e),(e=>{const t=r(e),a=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})((e=>{const t=r(e);return t.length>0?t[0]:n(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)},onSetup:g(e)});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)}))),onSetup:g(e)})})(e)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var e = tinymce.util.Tools.resolve("tinymce.PluginManager");
|
||||
const t = (e) => (t) => t.options.get(e),
|
||||
a = t("insertdatetime_dateformat"),
|
||||
n = t("insertdatetime_timeformat"),
|
||||
r = 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 n;
|
||||
n = /%[HMSIp]/.test(t) ? d(e, "%Y-%m-%dT%H:%M") : d(e, "%Y-%m-%d");
|
||||
const r = e.dom.getParent(e.selection.getStart(), "time");
|
||||
r
|
||||
? ((e, t, a, n) => {
|
||||
const r = e.dom.create("time", { datetime: a }, n);
|
||||
e.dom.replace(r, t),
|
||||
e.selection.select(r, !0),
|
||||
e.selection.collapse(!1);
|
||||
})(e, r, n, a)
|
||||
: e.insertContent('<time datetime="' + n + '">' + a + "</time>");
|
||||
} else e.insertContent(d(e, t));
|
||||
};
|
||||
var p = tinymce.util.Tools.resolve("tinymce.util.Tools");
|
||||
const g = (e) => (t) => {
|
||||
const a = () => {
|
||||
t.setEnabled(e.selection.isEditable());
|
||||
};
|
||||
return (
|
||||
e.on("NodeChange", a),
|
||||
a(),
|
||||
() => {
|
||||
e.off("NodeChange", a);
|
||||
}
|
||||
);
|
||||
};
|
||||
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, n) => {
|
||||
u(e, null != n ? n : a(e));
|
||||
}),
|
||||
e.addCommand("mceInsertTime", (t, a) => {
|
||||
u(e, null != a ? a : n(e));
|
||||
});
|
||||
})(e),
|
||||
((e) => {
|
||||
const t = r(e),
|
||||
a = ((e) => {
|
||||
let t = e;
|
||||
return {
|
||||
get: () => t,
|
||||
set: (e) => {
|
||||
t = e;
|
||||
},
|
||||
};
|
||||
})(
|
||||
((e) => {
|
||||
const t = r(e);
|
||||
return t.length > 0 ? t[0] : n(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);
|
||||
},
|
||||
onSetup: g(e),
|
||||
});
|
||||
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),
|
||||
})),
|
||||
onSetup: g(e),
|
||||
});
|
||||
})(e);
|
||||
});
|
||||
})();
|
||||
|
||||
1008
src/lib/dist/tinymce/plugins/link/plugin.min.js
vendored
1008
src/lib/dist/tinymce/plugins/link/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
1543
src/lib/dist/tinymce/plugins/lists/plugin.min.js
vendored
1543
src/lib/dist/tinymce/plugins/lists/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
1066
src/lib/dist/tinymce/plugins/media/plugin.min.js
vendored
1066
src/lib/dist/tinymce/plugins/media/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,83 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=n=>e=>typeof e===n,o=e("boolean"),a=e("number"),t=n=>e=>e.options.get(n),i=t("nonbreaking_force_tab"),s=t("nonbreaking_wrap"),r=(n,e)=>{let o="";for(let a=0;a<e;a++)o+=n;return o},c=(n,e)=>{const o=s(n)||n.plugins.visualchars?`<span class="${(n=>!!n.plugins.visualchars&&n.plugins.visualchars.isEnabled())(n)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap"}" contenteditable="false">${r(" ",e)}</span>`:r(" ",e);n.undoManager.transact((()=>n.insertContent(o)))};var l=tinymce.util.Tools.resolve("tinymce.util.VK");const u=n=>e=>{const o=()=>{e.setEnabled(n.selection.isEditable())};return n.on("NodeChange",o),o(),()=>{n.off("NodeChange",o)}};n.add("nonbreaking",(n=>{(n=>{const e=n.options.register;e("nonbreaking_force_tab",{processor:n=>o(n)?{value:n?3:0,valid:!0}:a(n)?{value:n,valid:!0}:{valid:!1,message:"Must be a boolean or number."},default:!1}),e("nonbreaking_wrap",{processor:"boolean",default:!0})})(n),(n=>{n.addCommand("mceNonBreaking",(()=>{c(n,1)}))})(n),(n=>{const e=()=>n.execCommand("mceNonBreaking");n.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:e,onSetup:u(n)}),n.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:e,onSetup:u(n)})})(n),(n=>{const e=i(n);e>0&&n.on("keydown",(o=>{if(o.keyCode===l.TAB&&!o.isDefaultPrevented()){if(o.shiftKey)return;o.preventDefault(),o.stopImmediatePropagation(),c(n,e)}}))})(n)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var n = tinymce.util.Tools.resolve("tinymce.PluginManager");
|
||||
const e = (n) => (e) => typeof e === n,
|
||||
o = e("boolean"),
|
||||
a = e("number"),
|
||||
t = (n) => (e) => e.options.get(n),
|
||||
i = t("nonbreaking_force_tab"),
|
||||
s = t("nonbreaking_wrap"),
|
||||
r = (n, e) => {
|
||||
let o = "";
|
||||
for (let a = 0; a < e; a++) o += n;
|
||||
return o;
|
||||
},
|
||||
c = (n, e) => {
|
||||
const o =
|
||||
s(n) || n.plugins.visualchars
|
||||
? `<span class="${((n) => !!n.plugins.visualchars && n.plugins.visualchars.isEnabled())(n) ? "mce-nbsp-wrap mce-nbsp" : "mce-nbsp-wrap"}" contenteditable="false">${r(" ", e)}</span>`
|
||||
: r(" ", e);
|
||||
n.undoManager.transact(() => n.insertContent(o));
|
||||
};
|
||||
var l = tinymce.util.Tools.resolve("tinymce.util.VK");
|
||||
const u = (n) => (e) => {
|
||||
const o = () => {
|
||||
e.setEnabled(n.selection.isEditable());
|
||||
};
|
||||
return (
|
||||
n.on("NodeChange", o),
|
||||
o(),
|
||||
() => {
|
||||
n.off("NodeChange", o);
|
||||
}
|
||||
);
|
||||
};
|
||||
n.add("nonbreaking", (n) => {
|
||||
((n) => {
|
||||
const e = n.options.register;
|
||||
e("nonbreaking_force_tab", {
|
||||
processor: (n) =>
|
||||
o(n)
|
||||
? { value: n ? 3 : 0, valid: !0 }
|
||||
: a(n)
|
||||
? { value: n, valid: !0 }
|
||||
: { valid: !1, message: "Must be a boolean or number." },
|
||||
default: !1,
|
||||
}),
|
||||
e("nonbreaking_wrap", { processor: "boolean", default: !0 });
|
||||
})(n),
|
||||
((n) => {
|
||||
n.addCommand("mceNonBreaking", () => {
|
||||
c(n, 1);
|
||||
});
|
||||
})(n),
|
||||
((n) => {
|
||||
const e = () => n.execCommand("mceNonBreaking");
|
||||
n.ui.registry.addButton("nonbreaking", {
|
||||
icon: "non-breaking",
|
||||
tooltip: "Nonbreaking space",
|
||||
onAction: e,
|
||||
onSetup: u(n),
|
||||
}),
|
||||
n.ui.registry.addMenuItem("nonbreaking", {
|
||||
icon: "non-breaking",
|
||||
text: "Nonbreaking space",
|
||||
onAction: e,
|
||||
onSetup: u(n),
|
||||
});
|
||||
})(n),
|
||||
((n) => {
|
||||
const e = i(n);
|
||||
e > 0 &&
|
||||
n.on("keydown", (o) => {
|
||||
if (o.keyCode === l.TAB && !o.isDefaultPrevented()) {
|
||||
if (o.shiftKey) return;
|
||||
o.preventDefault(), o.stopImmediatePropagation(), c(n, e);
|
||||
}
|
||||
});
|
||||
})(n);
|
||||
});
|
||||
})();
|
||||
|
||||
@ -1,4 +1,94 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env");const t=e=>a=>a.options.get(e),n=t("pagebreak_separator"),o=t("pagebreak_split_block"),r="mce-pagebreak",s=e=>{const t=`<img src="${a.transparentSrc}" class="${r}" data-mce-resize="false" data-mce-placeholder />`;return e?`<p>${t}</p>`:t},c=e=>a=>{const t=()=>{a.setEnabled(e.selection.isEditable())};return e.on("NodeChange",t),t(),()=>{e.off("NodeChange",t)}};e.add("pagebreak",(e=>{(e=>{const a=e.options.register;a("pagebreak_separator",{processor:"string",default:"\x3c!-- pagebreak --\x3e"}),a("pagebreak_split_block",{processor:"boolean",default:!1})})(e),(e=>{e.addCommand("mcePageBreak",(()=>{e.insertContent(s(o(e)))}))})(e),(e=>{const a=()=>e.execCommand("mcePageBreak");e.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:a,onSetup:c(e)}),e.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:a,onSetup:c(e)})})(e),(e=>{const a=n(e),t=()=>o(e),c=new RegExp(a.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,(e=>"\\"+e)),"gi");e.on("BeforeSetContent",(e=>{e.content=e.content.replace(c,s(t()))})),e.on("PreInit",(()=>{e.serializer.addNodeFilter("img",(n=>{let o,s,c=n.length;for(;c--;)if(o=n[c],s=o.attr("class"),s&&-1!==s.indexOf(r)){const n=o.parent;if(n&&e.schema.getBlockElements()[n.name]&&t()){n.type=3,n.value=a,n.raw=!0,o.remove();continue}o.type=3,o.value=a,o.raw=!0}}))}))})(e),(e=>{e.on("ResolveName",(a=>{"IMG"===a.target.nodeName&&e.dom.hasClass(a.target,r)&&(a.name="pagebreak")}))})(e)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var e = tinymce.util.Tools.resolve("tinymce.PluginManager"),
|
||||
a = tinymce.util.Tools.resolve("tinymce.Env");
|
||||
const t = (e) => (a) => a.options.get(e),
|
||||
n = t("pagebreak_separator"),
|
||||
o = t("pagebreak_split_block"),
|
||||
r = "mce-pagebreak",
|
||||
s = (e) => {
|
||||
const t = `<img src="${a.transparentSrc}" class="${r}" data-mce-resize="false" data-mce-placeholder />`;
|
||||
return e ? `<p>${t}</p>` : t;
|
||||
},
|
||||
c = (e) => (a) => {
|
||||
const t = () => {
|
||||
a.setEnabled(e.selection.isEditable());
|
||||
};
|
||||
return (
|
||||
e.on("NodeChange", t),
|
||||
t(),
|
||||
() => {
|
||||
e.off("NodeChange", t);
|
||||
}
|
||||
);
|
||||
};
|
||||
e.add("pagebreak", (e) => {
|
||||
((e) => {
|
||||
const a = e.options.register;
|
||||
a("pagebreak_separator", {
|
||||
processor: "string",
|
||||
default: "\x3c!-- pagebreak --\x3e",
|
||||
}),
|
||||
a("pagebreak_split_block", { processor: "boolean", default: !1 });
|
||||
})(e),
|
||||
((e) => {
|
||||
e.addCommand("mcePageBreak", () => {
|
||||
e.insertContent(s(o(e)));
|
||||
});
|
||||
})(e),
|
||||
((e) => {
|
||||
const a = () => e.execCommand("mcePageBreak");
|
||||
e.ui.registry.addButton("pagebreak", {
|
||||
icon: "page-break",
|
||||
tooltip: "Page break",
|
||||
onAction: a,
|
||||
onSetup: c(e),
|
||||
}),
|
||||
e.ui.registry.addMenuItem("pagebreak", {
|
||||
text: "Page break",
|
||||
icon: "page-break",
|
||||
onAction: a,
|
||||
onSetup: c(e),
|
||||
});
|
||||
})(e),
|
||||
((e) => {
|
||||
const a = n(e),
|
||||
t = () => o(e),
|
||||
c = new RegExp(
|
||||
a.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, (e) => "\\" + e),
|
||||
"gi",
|
||||
);
|
||||
e.on("BeforeSetContent", (e) => {
|
||||
e.content = e.content.replace(c, s(t()));
|
||||
}),
|
||||
e.on("PreInit", () => {
|
||||
e.serializer.addNodeFilter("img", (n) => {
|
||||
let o,
|
||||
s,
|
||||
c = n.length;
|
||||
for (; c--; )
|
||||
if (
|
||||
((o = n[c]), (s = o.attr("class")), s && -1 !== s.indexOf(r))
|
||||
) {
|
||||
const n = o.parent;
|
||||
if (n && e.schema.getBlockElements()[n.name] && t()) {
|
||||
(n.type = 3), (n.value = a), (n.raw = !0), o.remove();
|
||||
continue;
|
||||
}
|
||||
(o.type = 3), (o.value = a), (o.raw = !0);
|
||||
}
|
||||
});
|
||||
});
|
||||
})(e),
|
||||
((e) => {
|
||||
e.on("ResolveName", (a) => {
|
||||
"IMG" === a.target.nodeName &&
|
||||
e.dom.hasClass(a.target, r) &&
|
||||
(a.name = "pagebreak");
|
||||
});
|
||||
})(e);
|
||||
});
|
||||
})();
|
||||
|
||||
@ -1,4 +1,97 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=e=>t=>t.options.get(e),i=n("content_style"),s=n("content_css_cors"),c=n("body_class"),r=n("body_id");e.add("preview",(e=>{(e=>{e.addCommand("mcePreview",(()=>{(e=>{const n=(e=>{var n;let l="";const a=e.dom.encode,d=null!==(n=i(e))&&void 0!==n?n:"";l+='<base href="'+a(e.documentBaseURI.getURI())+'">';const m=s(e)?' crossorigin="anonymous"':"";o.each(e.contentCSS,(t=>{l+='<link type="text/css" rel="stylesheet" href="'+a(e.documentBaseURI.toAbsolute(t))+'"'+m+">"})),d&&(l+='<style type="text/css">'+d+"</style>");const y=r(e),u=c(e),v='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A" && !('+(t.os.isMacOS()||t.os.isiOS()?"e.metaKey":"e.ctrlKey && !e.altKey")+")) {e.preventDefault();}}}, false);<\/script> ",p=e.getBody().dir,w=p?' dir="'+a(p)+'"':"";return"<!DOCTYPE html><html><head>"+l+'</head><body id="'+a(y)+'" class="mce-content-body '+a(u)+'"'+w+">"+e.getContent()+v+"</body></html>"})(e);e.windowManager.open({title:"Preview",size:"large",body:{type:"panel",items:[{name:"preview",type:"iframe",sandboxed:!0,transparent:!1}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{preview:n}}).focus("close")})(e)}))})(e),(e=>{const t=()=>e.execCommand("mcePreview");e.ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:t}),e.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:t})})(e)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var e = tinymce.util.Tools.resolve("tinymce.PluginManager"),
|
||||
t = tinymce.util.Tools.resolve("tinymce.Env"),
|
||||
o = tinymce.util.Tools.resolve("tinymce.util.Tools");
|
||||
const n = (e) => (t) => t.options.get(e),
|
||||
i = n("content_style"),
|
||||
s = n("content_css_cors"),
|
||||
c = n("body_class"),
|
||||
r = n("body_id");
|
||||
e.add("preview", (e) => {
|
||||
((e) => {
|
||||
e.addCommand("mcePreview", () => {
|
||||
((e) => {
|
||||
const n = ((e) => {
|
||||
var n;
|
||||
let l = "";
|
||||
const a = e.dom.encode,
|
||||
d = null !== (n = i(e)) && void 0 !== n ? n : "";
|
||||
l += '<base href="' + a(e.documentBaseURI.getURI()) + '">';
|
||||
const m = s(e) ? ' crossorigin="anonymous"' : "";
|
||||
o.each(e.contentCSS, (t) => {
|
||||
l +=
|
||||
'<link type="text/css" rel="stylesheet" href="' +
|
||||
a(e.documentBaseURI.toAbsolute(t)) +
|
||||
'"' +
|
||||
m +
|
||||
">";
|
||||
}),
|
||||
d && (l += '<style type="text/css">' + d + "</style>");
|
||||
const y = r(e),
|
||||
u = c(e),
|
||||
v =
|
||||
'<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A" && !(' +
|
||||
(t.os.isMacOS() || t.os.isiOS()
|
||||
? "e.metaKey"
|
||||
: "e.ctrlKey && !e.altKey") +
|
||||
")) {e.preventDefault();}}}, false);</script> ",
|
||||
p = e.getBody().dir,
|
||||
w = p ? ' dir="' + a(p) + '"' : "";
|
||||
return (
|
||||
"<!DOCTYPE html><html><head>" +
|
||||
l +
|
||||
'</head><body id="' +
|
||||
a(y) +
|
||||
'" class="mce-content-body ' +
|
||||
a(u) +
|
||||
'"' +
|
||||
w +
|
||||
">" +
|
||||
e.getContent() +
|
||||
v +
|
||||
"</body></html>"
|
||||
);
|
||||
})(e);
|
||||
e.windowManager
|
||||
.open({
|
||||
title: "Preview",
|
||||
size: "large",
|
||||
body: {
|
||||
type: "panel",
|
||||
items: [
|
||||
{
|
||||
name: "preview",
|
||||
type: "iframe",
|
||||
sandboxed: !0,
|
||||
transparent: !1,
|
||||
},
|
||||
],
|
||||
},
|
||||
buttons: [
|
||||
{ type: "cancel", name: "close", text: "Close", primary: !0 },
|
||||
],
|
||||
initialData: { preview: n },
|
||||
})
|
||||
.focus("close");
|
||||
})(e);
|
||||
});
|
||||
})(e),
|
||||
((e) => {
|
||||
const t = () => e.execCommand("mcePreview");
|
||||
e.ui.registry.addButton("preview", {
|
||||
icon: "preview",
|
||||
tooltip: "Preview",
|
||||
onAction: t,
|
||||
}),
|
||||
e.ui.registry.addMenuItem("preview", {
|
||||
icon: "preview",
|
||||
text: "Preview",
|
||||
onAction: t,
|
||||
});
|
||||
})(e);
|
||||
});
|
||||
})();
|
||||
|
||||
308
src/lib/dist/tinymce/plugins/quickbars/plugin.min.js
vendored
308
src/lib/dist/tinymce/plugins/quickbars/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
74
src/lib/dist/tinymce/plugins/save/plugin.min.js
vendored
74
src/lib/dist/tinymce/plugins/save/plugin.min.js
vendored
@ -1,4 +1,76 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const n=("function",e=>"function"==typeof e);var o=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),t=tinymce.util.Tools.resolve("tinymce.util.Tools");const a=e=>n=>n.options.get(e),c=a("save_enablewhendirty"),i=a("save_onsavecallback"),s=a("save_oncancelcallback"),r=(e,n)=>{e.notificationManager.open({text:n,type:"error"})},l=e=>n=>{const o=()=>{n.setEnabled(!c(e)||e.isDirty())};return o(),e.on("NodeChange dirty",o),()=>e.off("NodeChange dirty",o)};e.add("save",(e=>{(e=>{const n=e.options.register;n("save_enablewhendirty",{processor:"boolean",default:!0}),n("save_onsavecallback",{processor:"function"}),n("save_oncancelcallback",{processor:"function"})})(e),(e=>{e.ui.registry.addButton("save",{icon:"save",tooltip:"Save",enabled:!1,onAction:()=>e.execCommand("mceSave"),onSetup:l(e)}),e.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",enabled:!1,onAction:()=>e.execCommand("mceCancel"),onSetup:l(e)}),e.addShortcut("Meta+S","","mceSave")})(e),(e=>{e.addCommand("mceSave",(()=>{(e=>{const t=o.DOM.getParent(e.id,"form");if(c(e)&&!e.isDirty())return;e.save();const a=i(e);if(n(a))return a.call(e,e),void e.nodeChanged();t?(e.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():r(e,"Error: Form submit field collision.")),e.nodeChanged()):r(e,"Error: No form element found.")})(e)})),e.addCommand("mceCancel",(()=>{(e=>{const o=t.trim(e.startContent),a=s(e);n(a)?a.call(e,e):e.resetContent(o)})(e)}))})(e)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var e = tinymce.util.Tools.resolve("tinymce.PluginManager");
|
||||
const n = ("function", (e) => "function" == typeof e);
|
||||
var o = tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),
|
||||
t = tinymce.util.Tools.resolve("tinymce.util.Tools");
|
||||
const a = (e) => (n) => n.options.get(e),
|
||||
c = a("save_enablewhendirty"),
|
||||
i = a("save_onsavecallback"),
|
||||
s = a("save_oncancelcallback"),
|
||||
r = (e, n) => {
|
||||
e.notificationManager.open({ text: n, type: "error" });
|
||||
},
|
||||
l = (e) => (n) => {
|
||||
const o = () => {
|
||||
n.setEnabled(!c(e) || e.isDirty());
|
||||
};
|
||||
return (
|
||||
o(), e.on("NodeChange dirty", o), () => e.off("NodeChange dirty", o)
|
||||
);
|
||||
};
|
||||
e.add("save", (e) => {
|
||||
((e) => {
|
||||
const n = e.options.register;
|
||||
n("save_enablewhendirty", { processor: "boolean", default: !0 }),
|
||||
n("save_onsavecallback", { processor: "function" }),
|
||||
n("save_oncancelcallback", { processor: "function" });
|
||||
})(e),
|
||||
((e) => {
|
||||
e.ui.registry.addButton("save", {
|
||||
icon: "save",
|
||||
tooltip: "Save",
|
||||
enabled: !1,
|
||||
onAction: () => e.execCommand("mceSave"),
|
||||
onSetup: l(e),
|
||||
}),
|
||||
e.ui.registry.addButton("cancel", {
|
||||
icon: "cancel",
|
||||
tooltip: "Cancel",
|
||||
enabled: !1,
|
||||
onAction: () => e.execCommand("mceCancel"),
|
||||
onSetup: l(e),
|
||||
}),
|
||||
e.addShortcut("Meta+S", "", "mceSave");
|
||||
})(e),
|
||||
((e) => {
|
||||
e.addCommand("mceSave", () => {
|
||||
((e) => {
|
||||
const t = o.DOM.getParent(e.id, "form");
|
||||
if (c(e) && !e.isDirty()) return;
|
||||
e.save();
|
||||
const a = i(e);
|
||||
if (n(a)) return a.call(e, e), void e.nodeChanged();
|
||||
t
|
||||
? (e.setDirty(!1),
|
||||
(t.onsubmit && !t.onsubmit()) ||
|
||||
("function" == typeof t.submit
|
||||
? t.submit()
|
||||
: r(e, "Error: Form submit field collision.")),
|
||||
e.nodeChanged())
|
||||
: r(e, "Error: No form element found.");
|
||||
})(e);
|
||||
}),
|
||||
e.addCommand("mceCancel", () => {
|
||||
((e) => {
|
||||
const o = t.trim(e.startContent),
|
||||
a = s(e);
|
||||
n(a) ? a.call(e, e) : e.resetContent(o);
|
||||
})(e);
|
||||
});
|
||||
})(e);
|
||||
});
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
2790
src/lib/dist/tinymce/plugins/table/plugin.min.js
vendored
2790
src/lib/dist/tinymce/plugins/table/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
490
src/lib/dist/tinymce/plugins/template/plugin.min.js
vendored
490
src/lib/dist/tinymce/plugins/template/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,72 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const s=(t,s,o)=>{t.dom.toggleClass(t.getBody(),"mce-visualblocks"),o.set(!o.get()),((t,s)=>{t.dispatch("VisualBlocks",{state:s})})(t,o.get())},o=("visualblocks_default_state",t=>t.options.get("visualblocks_default_state"));const e=(t,s)=>o=>{o.setActive(s.get());const e=t=>o.setActive(t.state);return t.on("VisualBlocks",e),()=>t.off("VisualBlocks",e)};t.add("visualblocks",((t,l)=>{(t=>{(0,t.options.register)("visualblocks_default_state",{processor:"boolean",default:!1})})(t);const a=(t=>{let s=!1;return{get:()=>s,set:t=>{s=t}}})();((t,o,e)=>{t.addCommand("mceVisualBlocks",(()=>{s(t,0,e)}))})(t,0,a),((t,s)=>{const o=()=>t.execCommand("mceVisualBlocks");t.ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:o,onSetup:e(t,s)}),t.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"visualblocks",onAction:o,onSetup:e(t,s)})})(t,a),((t,e,l)=>{t.on("PreviewFormats AfterPreviewFormats",(s=>{l.get()&&t.dom.toggleClass(t.getBody(),"mce-visualblocks","afterpreviewformats"===s.type)})),t.on("init",(()=>{o(t)&&s(t,0,l)}))})(t,0,a)}))}();
|
||||
!(function () {
|
||||
"use strict";
|
||||
var t = tinymce.util.Tools.resolve("tinymce.PluginManager");
|
||||
const s = (t, s, o) => {
|
||||
t.dom.toggleClass(t.getBody(), "mce-visualblocks"),
|
||||
o.set(!o.get()),
|
||||
((t, s) => {
|
||||
t.dispatch("VisualBlocks", { state: s });
|
||||
})(t, o.get());
|
||||
},
|
||||
o =
|
||||
("visualblocks_default_state",
|
||||
(t) => t.options.get("visualblocks_default_state"));
|
||||
const e = (t, s) => (o) => {
|
||||
o.setActive(s.get());
|
||||
const e = (t) => o.setActive(t.state);
|
||||
return t.on("VisualBlocks", e), () => t.off("VisualBlocks", e);
|
||||
};
|
||||
t.add("visualblocks", (t, l) => {
|
||||
((t) => {
|
||||
(0, t.options.register)("visualblocks_default_state", {
|
||||
processor: "boolean",
|
||||
default: !1,
|
||||
});
|
||||
})(t);
|
||||
const a = ((t) => {
|
||||
let s = !1;
|
||||
return {
|
||||
get: () => s,
|
||||
set: (t) => {
|
||||
s = t;
|
||||
},
|
||||
};
|
||||
})();
|
||||
((t, o, e) => {
|
||||
t.addCommand("mceVisualBlocks", () => {
|
||||
s(t, 0, e);
|
||||
});
|
||||
})(t, 0, a),
|
||||
((t, s) => {
|
||||
const o = () => t.execCommand("mceVisualBlocks");
|
||||
t.ui.registry.addToggleButton("visualblocks", {
|
||||
icon: "visualblocks",
|
||||
tooltip: "Show blocks",
|
||||
onAction: o,
|
||||
onSetup: e(t, s),
|
||||
}),
|
||||
t.ui.registry.addToggleMenuItem("visualblocks", {
|
||||
text: "Show blocks",
|
||||
icon: "visualblocks",
|
||||
onAction: o,
|
||||
onSetup: e(t, s),
|
||||
});
|
||||
})(t, a),
|
||||
((t, e, l) => {
|
||||
t.on("PreviewFormats AfterPreviewFormats", (s) => {
|
||||
l.get() &&
|
||||
t.dom.toggleClass(
|
||||
t.getBody(),
|
||||
"mce-visualblocks",
|
||||
"afterpreviewformats" === s.type,
|
||||
);
|
||||
}),
|
||||
t.on("init", () => {
|
||||
o(t) && s(t, 0, l);
|
||||
});
|
||||
})(t, 0, a);
|
||||
});
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
306
src/lib/dist/tinymce/plugins/wordcount/plugin.min.js
vendored
306
src/lib/dist/tinymce/plugins/wordcount/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1 +1,60 @@
|
||||
body{background-color:#222f3e;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}a{color:#4099ff}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#6d737b}figure{display:table;margin:1rem auto}figure figcaption{color:#8a8f97;display:block;margin-top:.25rem;text-align:center}hr{border-color:#6d737b;border-style:solid;border-width:1px 0 0 0}code{background-color:#6d737b;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #6d737b;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #6d737b;margin-right:1.5rem;padding-right:1rem}
|
||||
body {
|
||||
background-color: #222f3e;
|
||||
color: #fff;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
line-height: 1.4;
|
||||
margin: 1rem;
|
||||
}
|
||||
a {
|
||||
color: #4099ff;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table:not([cellpadding]) td,
|
||||
table:not([cellpadding]) th {
|
||||
padding: 0.4rem;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) th {
|
||||
border-width: 1px;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) th {
|
||||
border-style: solid;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) th {
|
||||
border-color: #6d737b;
|
||||
}
|
||||
figure {
|
||||
display: table;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
figure figcaption {
|
||||
color: #8a8f97;
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
hr {
|
||||
border-color: #6d737b;
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
code {
|
||||
background-color: #6d737b;
|
||||
border-radius: 3px;
|
||||
padding: 0.1rem 0.2rem;
|
||||
}
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #6d737b;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #6d737b;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
@ -1 +1,55 @@
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
line-height: 1.4;
|
||||
margin: 1rem;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table:not([cellpadding]) td,
|
||||
table:not([cellpadding]) th {
|
||||
padding: 0.4rem;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) th {
|
||||
border-width: 1px;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) th {
|
||||
border-style: solid;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) th {
|
||||
border-color: #ccc;
|
||||
}
|
||||
figure {
|
||||
display: table;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
figure figcaption {
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
hr {
|
||||
border-color: #ccc;
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
code {
|
||||
background-color: #e8e8e8;
|
||||
border-radius: 3px;
|
||||
padding: 0.1rem 0.2rem;
|
||||
}
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #ccc;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #ccc;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
@ -1 +1,60 @@
|
||||
@media screen{html{background:#f4f4f4;min-height:100%}}body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif}@media screen{body{background-color:#fff;box-shadow:0 0 4px rgba(0,0,0,.15);box-sizing:border-box;margin:1rem auto 0;max-width:820px;min-height:calc(100vh - 1rem);padding:4rem 6rem 6rem 6rem}}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure figcaption{color:#999;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
@media screen {
|
||||
html {
|
||||
background: #f4f4f4;
|
||||
min-height: 100%;
|
||||
}
|
||||
}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
}
|
||||
@media screen {
|
||||
body {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
|
||||
box-sizing: border-box;
|
||||
margin: 1rem auto 0;
|
||||
max-width: 820px;
|
||||
min-height: calc(100vh - 1rem);
|
||||
padding: 4rem 6rem 6rem 6rem;
|
||||
}
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table:not([cellpadding]) td,
|
||||
table:not([cellpadding]) th {
|
||||
padding: 0.4rem;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) th {
|
||||
border-width: 1px;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) th {
|
||||
border-style: solid;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) th {
|
||||
border-color: #ccc;
|
||||
}
|
||||
figure figcaption {
|
||||
color: #999;
|
||||
margin-top: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
hr {
|
||||
border-color: #ccc;
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #ccc;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #ccc;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
line-height: 1.4;
|
||||
margin: 1rem;
|
||||
}
|
||||
@ -31,12 +32,12 @@ code {
|
||||
border-radius: 3px;
|
||||
padding: 0.1rem 0.2rem;
|
||||
}
|
||||
.mce-content-body:not([dir=rtl]) blockquote {
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #ccc;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir=rtl] blockquote {
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #ccc;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
|
||||
@ -1 +1,44 @@
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}table{border-collapse:collapse}table td,table th{border:1px solid #ccc;padding:.4rem}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
line-height: 1.4;
|
||||
margin: 1rem;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table td,
|
||||
table th {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0.4rem;
|
||||
}
|
||||
figure {
|
||||
display: table;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
figure figcaption {
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
hr {
|
||||
border-color: #ccc;
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
code {
|
||||
background-color: #e8e8e8;
|
||||
border-radius: 3px;
|
||||
padding: 0.1rem 0.2rem;
|
||||
}
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #ccc;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #ccc;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
@ -1 +1,56 @@
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem auto;max-width:900px}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
line-height: 1.4;
|
||||
margin: 1rem auto;
|
||||
max-width: 900px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table:not([cellpadding]) td,
|
||||
table:not([cellpadding]) th {
|
||||
padding: 0.4rem;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-width"]) th {
|
||||
border-width: 1px;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-style"]) th {
|
||||
border-style: solid;
|
||||
}
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) td,
|
||||
table[border]:not([border="0"]):not([style*="border-color"]) th {
|
||||
border-color: #ccc;
|
||||
}
|
||||
figure {
|
||||
display: table;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
figure figcaption {
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
hr {
|
||||
border-color: #ccc;
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
code {
|
||||
background-color: #e8e8e8;
|
||||
border-radius: 3px;
|
||||
padding: 0.1rem 0.2rem;
|
||||
}
|
||||
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||
border-left: 2px solid #ccc;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.mce-content-body[dir="rtl"] blockquote {
|
||||
border-right: 2px solid #ccc;
|
||||
margin-right: 1.5rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
803
src/lib/dist/tinymce/skins/ui/oxide/content.min.css
vendored
803
src/lib/dist/tinymce/skins/ui/oxide/content.min.css
vendored
File diff suppressed because one or more lines are too long
4031
src/lib/dist/tinymce/skins/ui/oxide/skin.min.css
vendored
4031
src/lib/dist/tinymce/skins/ui/oxide/skin.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1 +1,30 @@
|
||||
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}
|
||||
body.tox-dialog__disable-scroll {
|
||||
overflow: hidden;
|
||||
}
|
||||
.tox-fullscreen {
|
||||
border: 0;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
overscroll-behavior: none;
|
||||
padding: 0;
|
||||
touch-action: pinch-zoom;
|
||||
width: 100%;
|
||||
}
|
||||
.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle {
|
||||
display: none;
|
||||
}
|
||||
.tox-shadowhost.tox-fullscreen,
|
||||
.tox.tox-tinymce.tox-fullscreen {
|
||||
left: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 1200;
|
||||
}
|
||||
.tox.tox-tinymce.tox-fullscreen {
|
||||
background-color: transparent;
|
||||
}
|
||||
.tox-fullscreen .tox.tox-tinymce-aux,
|
||||
.tox-fullscreen ~ .tox.tox-tinymce-aux {
|
||||
z-index: 1201;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4031
src/lib/dist/tinymce/skins/ui/stocknear/skin.min.css
vendored
4031
src/lib/dist/tinymce/skins/ui/stocknear/skin.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1 +1,30 @@
|
||||
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}
|
||||
body.tox-dialog__disable-scroll {
|
||||
overflow: hidden;
|
||||
}
|
||||
.tox-fullscreen {
|
||||
border: 0;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
overscroll-behavior: none;
|
||||
padding: 0;
|
||||
touch-action: pinch-zoom;
|
||||
width: 100%;
|
||||
}
|
||||
.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle {
|
||||
display: none;
|
||||
}
|
||||
.tox-shadowhost.tox-fullscreen,
|
||||
.tox.tox-tinymce.tox-fullscreen {
|
||||
left: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 1200;
|
||||
}
|
||||
.tox.tox-tinymce.tox-fullscreen {
|
||||
background-color: transparent;
|
||||
}
|
||||
.tox-fullscreen .tox.tox-tinymce-aux,
|
||||
.tox-fullscreen ~ .tox.tox-tinymce-aux {
|
||||
z-index: 1201;
|
||||
}
|
||||
|
||||
25929
src/lib/dist/tinymce/themes/silver/theme.min.js
vendored
25929
src/lib/dist/tinymce/themes/silver/theme.min.js
vendored
File diff suppressed because one or more lines are too long
25627
src/lib/dist/tinymce/tinymce.min.js
vendored
25627
src/lib/dist/tinymce/tinymce.min.js
vendored
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
@ -1,34 +1,34 @@
|
||||
import { browser } from "$app/environment";
|
||||
|
||||
const windowWithLemonSqueezy = browser
|
||||
? (window as unknown as {
|
||||
LemonSqueezy: any;
|
||||
createLemonSqueezy: () => void;
|
||||
})
|
||||
: undefined;
|
||||
? (window as unknown as {
|
||||
LemonSqueezy: any;
|
||||
createLemonSqueezy: () => void;
|
||||
})
|
||||
: undefined;
|
||||
|
||||
export async function openLemonSqueezyUrl(s: string) {
|
||||
const LemonSqueezy = await getLemonSqueezy();
|
||||
return LemonSqueezy.Url.Open(s);
|
||||
const LemonSqueezy = await getLemonSqueezy();
|
||||
return LemonSqueezy.Url.Open(s);
|
||||
}
|
||||
|
||||
async function getLemonSqueezy() {
|
||||
if (!windowWithLemonSqueezy?.LemonSqueezy) {
|
||||
await loadAndInitialize();
|
||||
}
|
||||
if (!windowWithLemonSqueezy?.LemonSqueezy) {
|
||||
await loadAndInitialize();
|
||||
}
|
||||
|
||||
return windowWithLemonSqueezy?.LemonSqueezy;
|
||||
return windowWithLemonSqueezy?.LemonSqueezy;
|
||||
}
|
||||
|
||||
function loadAndInitialize() {
|
||||
return new Promise<void>((resolve) => {
|
||||
const script = document.createElement("script");
|
||||
script.onload = function () {
|
||||
windowWithLemonSqueezy?.createLemonSqueezy();
|
||||
resolve();
|
||||
};
|
||||
script.src = "https://assets.lemonsqueezy.com/lemon.js";
|
||||
return new Promise<void>((resolve) => {
|
||||
const script = document.createElement("script");
|
||||
script.onload = function () {
|
||||
windowWithLemonSqueezy?.createLemonSqueezy();
|
||||
resolve();
|
||||
};
|
||||
script.src = "https://assets.lemonsqueezy.com/lemon.js";
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
}
|
||||
@ -1,17 +1,16 @@
|
||||
import PocketBase from 'pocketbase';
|
||||
import { userRegion } from '$lib/store';
|
||||
import PocketBase from "pocketbase";
|
||||
import { userRegion } from "$lib/store";
|
||||
|
||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
||||
const usRegion = ["cle1", "iad1", "pdx1", "sfo1"];
|
||||
|
||||
let pbUrl;
|
||||
|
||||
userRegion.subscribe(value => {
|
||||
|
||||
if (usRegion?.includes(value)) {
|
||||
pbUrl = import.meta.env.VITE_USEAST_POCKETBASE_URL;
|
||||
} else {
|
||||
pbUrl = import.meta.env.VITE_EU_POCKETBASE_URL;
|
||||
}
|
||||
});
|
||||
userRegion.subscribe((value) => {
|
||||
if (usRegion?.includes(value)) {
|
||||
pbUrl = import.meta.env.VITE_USEAST_POCKETBASE_URL;
|
||||
} else {
|
||||
pbUrl = import.meta.env.VITE_EU_POCKETBASE_URL;
|
||||
}
|
||||
});
|
||||
|
||||
export const pb = new PocketBase(pbUrl);
|
||||
|
||||
@ -1,133 +1,140 @@
|
||||
import { z } from 'zod';
|
||||
import { z } from "zod";
|
||||
|
||||
export const loginUserSchema = z.object({
|
||||
email: z
|
||||
.string({ required_error: 'Email is required' })
|
||||
.email({ message: 'Email must be a valid email.' }),
|
||||
password: z.string({ required_error: 'Password is required' })
|
||||
email: z
|
||||
.string({ required_error: "Email is required" })
|
||||
.email({ message: "Email must be a valid email." }),
|
||||
password: z.string({ required_error: "Password is required" }),
|
||||
});
|
||||
|
||||
export const registerUserSchema = z
|
||||
.object({
|
||||
username: z
|
||||
.string({ required_error: 'Username is required' })
|
||||
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, { message: 'Username can only contain letters, numbers, and special characters.' }) // Updated regex pattern
|
||||
.min(3, { message: 'Username must be at least 2 characters' })
|
||||
.max(64, { message: 'Username must be less than 64 characters' })
|
||||
.trim(),
|
||||
email: z
|
||||
.string({ required_error: 'Email is required' })
|
||||
.email({ message: 'Email must be a valid email' }),
|
||||
password: z
|
||||
.string({ required_error: 'Password is required' })
|
||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
||||
message:
|
||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
||||
}),
|
||||
passwordConfirm: z
|
||||
.string({ required_error: 'Confirm Password is required' })
|
||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
||||
message:
|
||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
||||
})
|
||||
})
|
||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||
if (passwordConfirm !== password) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Password & Confirm password must match',
|
||||
path: ['password']
|
||||
});
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Password & Confirm password must match',
|
||||
path: ['passwordConfirm']
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
.object({
|
||||
username: z
|
||||
.string({ required_error: "Username is required" })
|
||||
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, {
|
||||
message:
|
||||
"Username can only contain letters, numbers, and special characters.",
|
||||
}) // Updated regex pattern
|
||||
.min(3, { message: "Username must be at least 2 characters" })
|
||||
.max(64, { message: "Username must be less than 64 characters" })
|
||||
.trim(),
|
||||
email: z
|
||||
.string({ required_error: "Email is required" })
|
||||
.email({ message: "Email must be a valid email" }),
|
||||
password: z
|
||||
.string({ required_error: "Password is required" })
|
||||
.regex(
|
||||
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||
{
|
||||
message:
|
||||
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||
},
|
||||
),
|
||||
passwordConfirm: z
|
||||
.string({ required_error: "Confirm Password is required" })
|
||||
.regex(
|
||||
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||
{
|
||||
message:
|
||||
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||
},
|
||||
),
|
||||
})
|
||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||
if (passwordConfirm !== password) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Password & Confirm password must match",
|
||||
path: ["password"],
|
||||
});
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Password & Confirm password must match",
|
||||
path: ["passwordConfirm"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const createPostTextSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title is required' })
|
||||
.min(1, { message: 'Title is required' })
|
||||
.max(300, { message: 'Title must be 300 characters or less' })
|
||||
.trim(),
|
||||
title: z
|
||||
.string({ required_error: "Title is required" })
|
||||
.min(1, { message: "Title is required" })
|
||||
.max(300, { message: "Title must be 300 characters or less" })
|
||||
.trim(),
|
||||
|
||||
//url: z.string().optional().url({ message: 'URL must be a valid URL' }),
|
||||
tagline: z.string(),
|
||||
tagTopic: z.string(),
|
||||
atLeastOneTag: z.string({ required_error: 'At least 1 tag is required' })
|
||||
.min(1, { message: 'At least 1 tag is required' }),
|
||||
description: z.string(),
|
||||
postType: z.string({ required_error: 'PostType is required.' }),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
//url: z.string().optional().url({ message: 'URL must be a valid URL' }),
|
||||
tagline: z.string(),
|
||||
tagTopic: z.string(),
|
||||
atLeastOneTag: z
|
||||
.string({ required_error: "At least 1 tag is required" })
|
||||
.min(1, { message: "At least 1 tag is required" }),
|
||||
description: z.string(),
|
||||
postType: z.string({ required_error: "PostType is required." }),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
const imageTypes = [
|
||||
'image/jpeg',
|
||||
'image/jpg',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
'image/svg+xml',
|
||||
'image/gif'
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
"image/png",
|
||||
"image/webp",
|
||||
"image/svg+xml",
|
||||
"image/gif",
|
||||
];
|
||||
|
||||
const videoTypes = ['video/mp4', 'video/gif'];
|
||||
const videoTypes = ["video/mp4", "video/gif"];
|
||||
|
||||
export const createPostImageSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title is required' })
|
||||
.min(1, { message: 'Title is required' })
|
||||
.max(300, { message: 'Title must be 300 characters or less' })
|
||||
.string({ required_error: "Title is required" })
|
||||
.min(1, { message: "Title is required" })
|
||||
.max(300, { message: "Title must be 300 characters or less" })
|
||||
.trim(),
|
||||
tagTopic: z.string(),
|
||||
tagline: z.string(),
|
||||
atLeastOneTag: z.string({ required_error: 'At least 1 tag is required' }).min(1, { message: 'At least 1 tag is required' }),
|
||||
thumbnail: z
|
||||
.instanceof(File)
|
||||
.superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5121440) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'File must be less than 5MB',
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
val.type &&
|
||||
!imageTypes.includes(val.type) &&
|
||||
!videoTypes.includes(val.type)
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg',
|
||||
});
|
||||
}
|
||||
atLeastOneTag: z
|
||||
.string({ required_error: "At least 1 tag is required" })
|
||||
.min(1, { message: "At least 1 tag is required" }),
|
||||
thumbnail: z.instanceof(File).superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5121440) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "File must be less than 5MB",
|
||||
});
|
||||
}
|
||||
}),
|
||||
postType: z.string({ required_error: 'PostType is required.' }),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
|
||||
if (
|
||||
val.type &&
|
||||
!imageTypes.includes(val.type) &&
|
||||
!videoTypes.includes(val.type)
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg",
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
postType: z.string({ required_error: "PostType is required." }),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const createPostLinkSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title is required' })
|
||||
.min(1, { message: 'Title is required' })
|
||||
.max(300, { message: 'Title must be 300 characters or less' })
|
||||
.trim(),
|
||||
tagTopic: z.string(),
|
||||
tagline: z.string(),
|
||||
atLeastOneTag: z.string({ required_error: 'At least 1 tag is required' })
|
||||
.min(1, { message: 'At least 1 tag is required' }),
|
||||
link: z.string().url({ message: 'URL must be a valid URL' }),
|
||||
description: z.string(),
|
||||
/*
|
||||
title: z
|
||||
.string({ required_error: "Title is required" })
|
||||
.min(1, { message: "Title is required" })
|
||||
.max(300, { message: "Title must be 300 characters or less" })
|
||||
.trim(),
|
||||
tagTopic: z.string(),
|
||||
tagline: z.string(),
|
||||
atLeastOneTag: z
|
||||
.string({ required_error: "At least 1 tag is required" })
|
||||
.min(1, { message: "At least 1 tag is required" }),
|
||||
link: z.string().url({ message: "URL must be a valid URL" }),
|
||||
description: z.string(),
|
||||
/*
|
||||
thumbnail: z
|
||||
.instanceof(Blob)
|
||||
.superRefine((val, ctx) => {
|
||||
@ -148,265 +155,240 @@ export const createPostLinkSchema = z.object({
|
||||
}
|
||||
}),
|
||||
*/
|
||||
postType: z.string({ required_error: 'PostType is required.' }),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
postType: z.string({ required_error: "PostType is required." }),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
//export const updatePostSchema = createPostSchema.omit({ user: true });
|
||||
|
||||
|
||||
export const updatePersonalDataSchema = z.object({
|
||||
/*
|
||||
/*
|
||||
email: z
|
||||
.string({ required_error: 'Email is required' })
|
||||
.email({ message: 'Email must be a valid email' }),
|
||||
*/
|
||||
username: z
|
||||
.string({ required_error: 'Username is required' })
|
||||
.min(2, { message: 'Username must be at least 2 characters' })
|
||||
.max(24, { message: 'Username must be 24 characters or less' })
|
||||
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, { message: 'Username can only contain letters, numbers, and special characters.' }) // Updated regex pattern
|
||||
});
|
||||
|
||||
username: z
|
||||
.string({ required_error: "Username is required" })
|
||||
.min(2, { message: "Username must be at least 2 characters" })
|
||||
.max(24, { message: "Username must be 24 characters or less" })
|
||||
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, {
|
||||
message:
|
||||
"Username can only contain letters, numbers, and special characters.",
|
||||
}), // Updated regex pattern
|
||||
});
|
||||
|
||||
export const updateEmailSchema = z.object({
|
||||
email: z
|
||||
.string({ required_error: 'Email is required' })
|
||||
.email({ message: 'Email must be a valid email' })
|
||||
email: z
|
||||
.string({ required_error: "Email is required" })
|
||||
.email({ message: "Email must be a valid email" }),
|
||||
});
|
||||
|
||||
export const updateUsernameSchema = z.object({
|
||||
username: z
|
||||
.string({ required_error: 'Username is required' })
|
||||
.min(2, { message: 'Username must be at least 2 characters' })
|
||||
.max(24, { message: 'Username must be 24 characters or less' })
|
||||
.regex(/^[a-zA-Z0-9]*$/, { message: 'Username can only contain letters or numbers.' })
|
||||
username: z
|
||||
.string({ required_error: "Username is required" })
|
||||
.min(2, { message: "Username must be at least 2 characters" })
|
||||
.max(24, { message: "Username must be 24 characters or less" })
|
||||
.regex(/^[a-zA-Z0-9]*$/, {
|
||||
message: "Username can only contain letters or numbers.",
|
||||
}),
|
||||
});
|
||||
|
||||
export const updatePasswordSchema = z
|
||||
.object({
|
||||
oldPassword: z.string({ required_error: 'Old password is required' }),
|
||||
password: z
|
||||
.string({ required_error: 'Password is required' })
|
||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
||||
message:
|
||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
||||
}),
|
||||
passwordConfirm: z
|
||||
.string({ required_error: 'Confirm Password is required' })
|
||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
||||
message:
|
||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
||||
})
|
||||
})
|
||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||
if (passwordConfirm !== password) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Password & Confirm password must match',
|
||||
path: ['password']
|
||||
});
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Password & Confirm password must match',
|
||||
path: ['passwordConfirm']
|
||||
});
|
||||
}
|
||||
});
|
||||
.object({
|
||||
oldPassword: z.string({ required_error: "Old password is required" }),
|
||||
password: z
|
||||
.string({ required_error: "Password is required" })
|
||||
.regex(
|
||||
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||
{
|
||||
message:
|
||||
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||
},
|
||||
),
|
||||
passwordConfirm: z
|
||||
.string({ required_error: "Confirm Password is required" })
|
||||
.regex(
|
||||
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||
{
|
||||
message:
|
||||
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||
},
|
||||
),
|
||||
})
|
||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||
if (passwordConfirm !== password) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Password & Confirm password must match",
|
||||
path: ["password"],
|
||||
});
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Password & Confirm password must match",
|
||||
path: ["passwordConfirm"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const updateProfileSchema = z.object({
|
||||
name: z
|
||||
.string({ required_error: 'Name is required' })
|
||||
.min(1, { message: 'Name is required' })
|
||||
.max(64, { message: 'Name must be 64 characters or less' })
|
||||
.trim(),
|
||||
avatar: z
|
||||
.instanceof(Blob)
|
||||
.optional()
|
||||
.superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5242880) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Avatar must be less than 5MB'
|
||||
});
|
||||
}
|
||||
|
||||
if (!imageTypes.includes(val.type)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const updateAvatarSchema = z.object({
|
||||
avatar: z
|
||||
.instanceof(File)
|
||||
name: z
|
||||
.string({ required_error: "Name is required" })
|
||||
.min(1, { message: "Name is required" })
|
||||
.max(64, { message: "Name must be 64 characters or less" })
|
||||
.trim(),
|
||||
avatar: z
|
||||
.instanceof(Blob)
|
||||
.optional()
|
||||
.superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5242880) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Avatar must be less than 5MB',
|
||||
message: "Avatar must be less than 5MB",
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
val.type &&
|
||||
!imageTypes.includes(val.type) &&
|
||||
!videoTypes.includes(val.type)
|
||||
) {
|
||||
if (!imageTypes.includes(val.type)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif',
|
||||
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif",
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export const updateAvatarSchema = z.object({
|
||||
avatar: z.instanceof(File).superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5242880) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Avatar must be less than 5MB",
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
val.type &&
|
||||
!imageTypes.includes(val.type) &&
|
||||
!videoTypes.includes(val.type)
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif",
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export const createCommentTextSchema = z.object({
|
||||
comment: z
|
||||
.string({ required_error: 'Comment cannot be empty' })
|
||||
.min(1, { message: 'Comment cannot be empty' })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
post: z.string({ required_error: 'Post is required.' }),
|
||||
reply: z.string(),
|
||||
|
||||
comment: z
|
||||
.string({ required_error: "Comment cannot be empty" })
|
||||
.min(1, { message: "Comment cannot be empty" })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
post: z.string({ required_error: "Post is required." }),
|
||||
reply: z.string(),
|
||||
});
|
||||
|
||||
export const updateCommentTextSchema = z.object({
|
||||
comment: z
|
||||
.string({ required_error: 'Comment cannot be empty' })
|
||||
.min(1, { message: 'Comment cannot be empty' })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
comment: z
|
||||
.string({ required_error: "Comment cannot be empty" })
|
||||
.min(1, { message: "Comment cannot be empty" })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
});
|
||||
|
||||
|
||||
export const createCommentImageSchema = z.object({
|
||||
comment: z
|
||||
.string({ required_error: 'Comment cannot be empty' })
|
||||
.min(1, { message: 'Comment cannot be empty' })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
image: z
|
||||
.instanceof(Blob, { message: 'Image is required' })
|
||||
.superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5242880) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Image must be less than 5MB'
|
||||
});
|
||||
}
|
||||
|
||||
if (!imageTypes.includes(val.type)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: 'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif'
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
post: z.string({ required_error: 'Post is required.' }),
|
||||
reply: z.string(),
|
||||
comment: z
|
||||
.string({ required_error: "Comment cannot be empty" })
|
||||
.min(1, { message: "Comment cannot be empty" })
|
||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
image: z
|
||||
.instanceof(Blob, { message: "Image is required" })
|
||||
.superRefine((val, ctx) => {
|
||||
if (val) {
|
||||
if (val.size > 5242880) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "Image must be less than 5MB",
|
||||
});
|
||||
}
|
||||
|
||||
if (!imageTypes.includes(val.type)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif",
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
post: z.string({ required_error: "Post is required." }),
|
||||
reply: z.string(),
|
||||
});
|
||||
|
||||
|
||||
export const createNotebookSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title cannot be empty' })
|
||||
.min(1, { message: 'Title cannot be empty' })
|
||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
|
||||
title: z
|
||||
.string({ required_error: "Title cannot be empty" })
|
||||
.min(1, { message: "Title cannot be empty" })
|
||||
.max(100, {
|
||||
message: "Title is too long. Keep it simple and concise bruv!",
|
||||
})
|
||||
.trim(),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const createStrategySchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title cannot be empty' })
|
||||
.min(1, { message: 'Title cannot be empty' })
|
||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
rules: z
|
||||
.string()
|
||||
.trim(),
|
||||
results: z
|
||||
.string()
|
||||
.trim(),
|
||||
liveResults: z
|
||||
.string()
|
||||
.trim(),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
|
||||
title: z
|
||||
.string({ required_error: "Title cannot be empty" })
|
||||
.min(1, { message: "Title cannot be empty" })
|
||||
.max(100, {
|
||||
message: "Title is too long. Keep it simple and concise bruv!",
|
||||
})
|
||||
.trim(),
|
||||
rules: z.string().trim(),
|
||||
results: z.string().trim(),
|
||||
liveResults: z.string().trim(),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
export const createPortfolioSchema = z.object({
|
||||
accountValue: z
|
||||
.string()
|
||||
.trim(),
|
||||
availableCash: z
|
||||
.string()
|
||||
.trim(),
|
||||
overallReturn: z
|
||||
.string()
|
||||
.trim(),
|
||||
rank: z
|
||||
.string()
|
||||
.trim(),
|
||||
holdings: z
|
||||
.string()
|
||||
.trim(),
|
||||
tradingHistory: z
|
||||
.string()
|
||||
.trim(),
|
||||
metrics: z
|
||||
.string()
|
||||
.trim(),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
|
||||
accountValue: z.string().trim(),
|
||||
availableCash: z.string().trim(),
|
||||
overallReturn: z.string().trim(),
|
||||
rank: z.string().trim(),
|
||||
holdings: z.string().trim(),
|
||||
tradingHistory: z.string().trim(),
|
||||
metrics: z.string().trim(),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
export const createWatchListSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title cannot be empty' })
|
||||
.min(1, { message: 'Title cannot be empty' })
|
||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
ticker: z
|
||||
.string()
|
||||
.trim(),
|
||||
user: z.string({ required_error: 'User is required.' }),
|
||||
|
||||
title: z
|
||||
.string({ required_error: "Title cannot be empty" })
|
||||
.min(1, { message: "Title cannot be empty" })
|
||||
.max(100, {
|
||||
message: "Title is too long. Keep it simple and concise bruv!",
|
||||
})
|
||||
.trim(),
|
||||
ticker: z.string().trim(),
|
||||
user: z.string({ required_error: "User is required." }),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const editWatchListSchema = z.object({
|
||||
title: z
|
||||
.string({ required_error: 'Title cannot be empty' })
|
||||
.min(1, { message: 'Title cannot be empty' })
|
||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
||||
.trim(),
|
||||
watchListId: z.string({ required_error: 'Id is required.' }),
|
||||
|
||||
title: z
|
||||
.string({ required_error: "Title cannot be empty" })
|
||||
.min(1, { message: "Title cannot be empty" })
|
||||
.max(100, {
|
||||
message: "Title is too long. Keep it simple and concise bruv!",
|
||||
})
|
||||
.trim(),
|
||||
watchListId: z.string({ required_error: "Id is required." }),
|
||||
});
|
||||
|
||||
@ -1,94 +1,94 @@
|
||||
function generateDateList(val) {
|
||||
var currentDate = new Date(); // Get the current date
|
||||
var currentDate = new Date(); // Get the current date
|
||||
|
||||
var dateList = [];
|
||||
dateList.push(formatDate(currentDate)); // Add current date to the list
|
||||
var dateList = [];
|
||||
dateList.push(formatDate(currentDate)); // Add current date to the list
|
||||
|
||||
for (var i = 1; i <= val; i++) { // Generate 10 more dates, 30 days apart
|
||||
var previousDate = new Date(currentDate.getTime() - (i * 1 * 24 * 60 * 60 * 1000)); // Calculate the previous date
|
||||
dateList.unshift(formatDate(previousDate)); // Add the previous date to the beginning of the list
|
||||
}
|
||||
|
||||
return dateList;
|
||||
for (var i = 1; i <= val; i++) {
|
||||
// Generate 10 more dates, 30 days apart
|
||||
var previousDate = new Date(
|
||||
currentDate.getTime() - i * 1 * 24 * 60 * 60 * 1000,
|
||||
); // Calculate the previous date
|
||||
dateList.unshift(formatDate(previousDate)); // Add the previous date to the beginning of the list
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = ('0' + (date.getMonth() + 1)).slice(-2); // Month is zero-based, so we add 1
|
||||
var day = ('0' + date.getDate()).slice(-2);
|
||||
return dateList;
|
||||
}
|
||||
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
function formatDate(date) {
|
||||
var year = date.getFullYear();
|
||||
var month = ("0" + (date.getMonth() + 1)).slice(-2); // Month is zero-based, so we add 1
|
||||
var day = ("0" + date.getDate()).slice(-2);
|
||||
|
||||
var dateList = generateDateList(30);
|
||||
return year + "-" + month + "-" + day;
|
||||
}
|
||||
|
||||
var dateList = generateDateList(30);
|
||||
|
||||
function generateRandomNumberList() {
|
||||
var numberList = [];
|
||||
var numberList = [];
|
||||
|
||||
for (var i = 0; i < 30; i++) {
|
||||
var randomNumber = Math.floor(Math.random() * (80 - 20 + 1)) + 20; // Generate random number between 20 and 80
|
||||
numberList.push(randomNumber); // Add the random number to the list
|
||||
}
|
||||
|
||||
return numberList;
|
||||
for (var i = 0; i < 30; i++) {
|
||||
var randomNumber = Math.floor(Math.random() * (80 - 20 + 1)) + 20; // Generate random number between 20 and 80
|
||||
numberList.push(randomNumber); // Add the random number to the list
|
||||
}
|
||||
|
||||
function generateTrigonometricNumberList(val) {
|
||||
var numberList = [];
|
||||
return numberList;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var angle = (i / 100) * Math.PI * 2 ; // Calculate the angle based on the index
|
||||
var value = Math.sin(angle) * val; // Calculate the sine value
|
||||
numberList.push(value); // Add the value to the list
|
||||
}
|
||||
function generateTrigonometricNumberList(val) {
|
||||
var numberList = [];
|
||||
|
||||
return numberList;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var angle = (i / 100) * Math.PI * 2; // Calculate the angle based on the index
|
||||
var value = Math.sin(angle) * val; // Calculate the sine value
|
||||
numberList.push(value); // Add the value to the list
|
||||
}
|
||||
|
||||
return numberList;
|
||||
}
|
||||
|
||||
var rsiList = generateRandomNumberList();
|
||||
export const rsiGraph = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: dateList
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: rsiList,
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#FFF' // Red color for the line
|
||||
}
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: dateList,
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: rsiList,
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#FFF", // Red color for the line
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
data: Array(30).fill(30),
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#0BA111', // Red color for the line
|
||||
width: 4,
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
data: Array(30).fill(30),
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#0BA111", // Red color for the line
|
||||
width: 4,
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
data: Array(30).fill(70),
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#FF0000', // Red color for the line
|
||||
width: 4,
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
},
|
||||
{
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
data: Array(30).fill(70),
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#FF0000", // Red color for the line
|
||||
width: 4,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
//MACD Indicator
|
||||
var macdList = generateTrigonometricNumberList(1);
|
||||
@ -96,70 +96,66 @@ var macdLineList = generateTrigonometricNumberList(1.5);
|
||||
|
||||
var macdDateList = generateDateList(100);
|
||||
export const macdGraph = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: macdDateList
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: macdDateList,
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: macdList,
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#0BA111' // Red color for the line
|
||||
}
|
||||
data: macdList,
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#0BA111", // Red color for the line
|
||||
},
|
||||
},
|
||||
{
|
||||
data: macdLineList,
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#FF0000' // Red color for the line
|
||||
}
|
||||
data: macdLineList,
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#FF0000", // Red color for the line
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//MACD Indicator
|
||||
var sma50List = generateTrigonometricNumberList(100);
|
||||
var sma200List = generateTrigonometricNumberList(120);
|
||||
|
||||
|
||||
var smaDateList = generateDateList(100);
|
||||
export const smaGraph = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: smaDateList
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: smaDateList,
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: sma50List,
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#0BA111' // Red color for the line
|
||||
}
|
||||
data: sma50List,
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#0BA111", // Red color for the line
|
||||
},
|
||||
},
|
||||
{
|
||||
data: sma200List,
|
||||
type: 'line',
|
||||
symbol: 'none', // Remove the dots
|
||||
lineStyle: {
|
||||
type: 'solid', // Make the line solid
|
||||
color: '#FF0000' // Red color for the line
|
||||
}
|
||||
data: sma200List,
|
||||
type: "line",
|
||||
symbol: "none", // Remove the dots
|
||||
lineStyle: {
|
||||
type: "solid", // Make the line solid
|
||||
color: "#FF0000", // Red color for the line
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
@ -20,7 +20,7 @@ type FlyAndScaleParams = {
|
||||
|
||||
export const flyAndScale = (
|
||||
node: Element,
|
||||
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 0 }
|
||||
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 0 },
|
||||
): TransitionConfig => {
|
||||
const style = getComputedStyle(node);
|
||||
const transform = style.transform === "none" ? "" : style.transform;
|
||||
@ -28,7 +28,7 @@ export const flyAndScale = (
|
||||
const scaleConversion = (
|
||||
valueA: number,
|
||||
scaleA: [number, number],
|
||||
scaleB: [number, number]
|
||||
scaleB: [number, number],
|
||||
) => {
|
||||
const [minA, maxA] = scaleA;
|
||||
const [minB, maxB] = scaleB;
|
||||
@ -40,7 +40,7 @@ export const flyAndScale = (
|
||||
};
|
||||
|
||||
const styleToString = (
|
||||
style: Record<string, number | string | undefined>
|
||||
style: Record<string, number | string | undefined>,
|
||||
): string => {
|
||||
return Object.keys(style).reduce((str, key) => {
|
||||
if (style[key] === undefined) return str;
|
||||
@ -212,7 +212,7 @@ export function sumQuarterlyResultsByYear(quarterlyResults, namingList) {
|
||||
|
||||
// Filter out years with less than 4 quarters
|
||||
const validYears = Object?.keys(quarterCounts)?.filter(
|
||||
(year) => quarterCounts[year] === 4
|
||||
(year) => quarterCounts[year] === 4,
|
||||
);
|
||||
const annualResults = validYears?.map((year) => yearlySummaries[year]);
|
||||
|
||||
@ -420,7 +420,7 @@ export function formatETFName(inputString) {
|
||||
|
||||
// Capitalize the first letter of each word
|
||||
const capitalizedWords = words?.map(
|
||||
(word) => word.charAt(0)?.toUpperCase() + word?.slice(1)
|
||||
(word) => word.charAt(0)?.toUpperCase() + word?.slice(1),
|
||||
);
|
||||
|
||||
// Join the words back together with a space between them
|
||||
@ -442,7 +442,7 @@ export function addDays(data, days, state) {
|
||||
} else {
|
||||
const differenceInTime = result - createdDate;
|
||||
const differenceInDays = Math.round(
|
||||
differenceInTime / (1000 * 60 * 60 * 24)
|
||||
differenceInTime / (1000 * 60 * 60 * 24),
|
||||
);
|
||||
return Math.abs(differenceInDays);
|
||||
}
|
||||
|
||||
@ -1,41 +1,43 @@
|
||||
// lib/workers/test.ts
|
||||
|
||||
async function loadNotifications(fastifyURL:string, userId:string) {
|
||||
async function loadNotifications(fastifyURL: string, userId: string) {
|
||||
const postData = { userId: userId };
|
||||
|
||||
const postData = {'userId': userId};
|
||||
const response = await fetch(fastifyURL + "/get-notifications", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(postData),
|
||||
});
|
||||
|
||||
const response = await fetch(fastifyURL+'/get-notifications', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(postData)
|
||||
});
|
||||
|
||||
const output = (await response.json())?.items;
|
||||
return output
|
||||
const output = (await response.json())?.items;
|
||||
return output;
|
||||
}
|
||||
|
||||
onmessage = async (event: MessageEvent) => {
|
||||
const data = event.data?.message;
|
||||
const fastifyURL = data?.fastifyURL;
|
||||
const userId = data?.userId;
|
||||
try {
|
||||
onmessage = async (event: MessageEvent) => {
|
||||
const data = event.data?.message;
|
||||
const fastifyURL = data?.fastifyURL;
|
||||
const userId = data?.userId;
|
||||
try {
|
||||
const [notificationList] = await Promise.all([
|
||||
loadNotifications(fastifyURL, userId),
|
||||
]);
|
||||
|
||||
const [notificationList] = await Promise.all([
|
||||
loadNotifications(fastifyURL, userId),
|
||||
]);
|
||||
|
||||
const numberOfUnreadNotification = notificationList?.length
|
||||
const numberOfUnreadNotification = notificationList?.length;
|
||||
const hasUnreadElement = notificationList?.length !== 0 ? true : false;
|
||||
const output = {notificationList, hasUnreadElement, numberOfUnreadNotification}
|
||||
const output = {
|
||||
notificationList,
|
||||
hasUnreadElement,
|
||||
numberOfUnreadNotification,
|
||||
};
|
||||
|
||||
postMessage({ message: 'success', output});
|
||||
} catch(e) {
|
||||
postMessage({ message: 'error', e});
|
||||
}
|
||||
// Sending data back to the main thread
|
||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||
};
|
||||
postMessage({ message: "success", output });
|
||||
} catch (e) {
|
||||
postMessage({ message: "error", e });
|
||||
}
|
||||
// Sending data back to the main thread
|
||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||
};
|
||||
|
||||
export {};
|
||||
export {};
|
||||
|
||||
@ -1,32 +1,30 @@
|
||||
async function loadTwitchStatus(fastifyURL:string,) {
|
||||
// make the GET request to the endpoint
|
||||
const response = await fetch(fastifyURL+'/get-twitch-status', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json","X-API-KEY": apiKey
|
||||
},
|
||||
});
|
||||
async function loadTwitchStatus(fastifyURL: string) {
|
||||
// make the GET request to the endpoint
|
||||
const response = await fetch(fastifyURL + "/get-twitch-status", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-API-KEY": apiKey,
|
||||
},
|
||||
});
|
||||
|
||||
const output = (await response.json())?.items;
|
||||
return output;
|
||||
const output = (await response.json())?.items;
|
||||
return output;
|
||||
}
|
||||
|
||||
onmessage = async (event: MessageEvent) => {
|
||||
const data = event.data?.message;
|
||||
const fastifyURL = data?.fastifyURL;
|
||||
try {
|
||||
const twitchStatus = await loadTwitchStatus(fastifyURL);
|
||||
const output = { twitchStatus };
|
||||
|
||||
postMessage({ message: "success", output });
|
||||
} catch (e) {
|
||||
postMessage({ message: "error", e });
|
||||
}
|
||||
// Sending data back to the main thread
|
||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||
};
|
||||
|
||||
|
||||
|
||||
onmessage = async (event: MessageEvent) => {
|
||||
const data = event.data?.message;
|
||||
const fastifyURL = data?.fastifyURL;
|
||||
try {
|
||||
|
||||
const twitchStatus = await loadTwitchStatus(fastifyURL);
|
||||
const output = {twitchStatus};
|
||||
|
||||
postMessage({ message: 'success', output});
|
||||
} catch(e) {
|
||||
postMessage({ message: 'error', e});
|
||||
}
|
||||
// Sending data back to the main thread
|
||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||
};
|
||||
|
||||
export {};
|
||||
export {};
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const load = ({ locals, cookies }) => {
|
||||
const { user, region, apiURL, fastifyURL, wsURL, apiKey } = locals;
|
||||
const { user, region, apiURL, fastifyURL, wsURL, apiKey } = locals;
|
||||
|
||||
return {
|
||||
user: user || undefined,
|
||||
region,
|
||||
cookieConsent: cookies?.get('cookie-consent'),
|
||||
apiURL,
|
||||
fastifyURL,
|
||||
wsURL,
|
||||
apiKey,
|
||||
};
|
||||
return {
|
||||
user: user || undefined,
|
||||
region,
|
||||
cookieConsent: cookies?.get("cookie-consent"),
|
||||
apiURL,
|
||||
fastifyURL,
|
||||
wsURL,
|
||||
apiKey,
|
||||
};
|
||||
};
|
||||
|
||||
@ -18,7 +18,7 @@ export const actions = {
|
||||
login: async ({ request, locals }) => {
|
||||
const { formData, errors } = await validateData(
|
||||
await request.formData(),
|
||||
loginUserSchema
|
||||
loginUserSchema,
|
||||
);
|
||||
|
||||
if (errors) {
|
||||
@ -52,7 +52,7 @@ export const actions = {
|
||||
register: async ({ locals, request }) => {
|
||||
const { formData, errors } = await validateData(
|
||||
await request.formData(),
|
||||
registerUserSchema
|
||||
registerUserSchema,
|
||||
);
|
||||
if (errors) {
|
||||
return fail(400, {
|
||||
@ -122,7 +122,7 @@ export const actions = {
|
||||
const redirectURL = `${url.origin}/oauth`;
|
||||
|
||||
const targetItem = authMethods.authProviders?.findIndex(
|
||||
(item) => item?.name === providerSelected
|
||||
(item) => item?.name === providerSelected,
|
||||
);
|
||||
//console.log("==================")
|
||||
//console.log(authMethods.authProviders)
|
||||
|
||||
@ -18,7 +18,7 @@ export const load = async ({ parent }) => {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
output = (await response.json())["stargazers_count"];
|
||||
@ -43,7 +43,7 @@ export const load = async ({ parent }) => {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
output = (await response.json())["stargazers_count"];
|
||||
|
||||
@ -1,32 +1,31 @@
|
||||
import { getCache, setCache } from '$lib/store';
|
||||
import { getCache, setCache } from "$lib/store";
|
||||
|
||||
|
||||
export const load = async ({parent, params}) => {
|
||||
export const load = async ({ parent, params }) => {
|
||||
const getAnalystStats = async () => {
|
||||
let output;
|
||||
|
||||
// Get cached data for the specific tickerID
|
||||
const cachedData = getCache(params.slug, 'getAnalystStats');
|
||||
const cachedData = getCache(params.slug, "getAnalystStats");
|
||||
if (cachedData) {
|
||||
output = cachedData;
|
||||
} else {
|
||||
const { apiURL, apiKey } = await parent();
|
||||
|
||||
const { apiURL, apiKey} = await parent();
|
||||
|
||||
const postData = {'analystId': params.slug}
|
||||
const postData = { analystId: params.slug };
|
||||
// make the POST request to the endpoint
|
||||
const response = await fetch(apiURL + '/analyst-stats', {
|
||||
method: 'POST',
|
||||
const response = await fetch(apiURL + "/analyst-stats", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
||||
"Content-Type": "application/json",
|
||||
"X-API-KEY": apiKey,
|
||||
},
|
||||
body: JSON.stringify(postData)
|
||||
body: JSON.stringify(postData),
|
||||
});
|
||||
|
||||
output = await response.json();
|
||||
|
||||
// Cache the data for this specific tickerID with a specific name 'getAnalystStats'
|
||||
setCache(params.slug, output, 'getAnalystStats');
|
||||
setCache(params.slug, output, "getAnalystStats");
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -34,6 +33,6 @@ export const load = async ({parent, params}) => {
|
||||
|
||||
// Make sure to return a promise
|
||||
return {
|
||||
getAnalystStats: await getAnalystStats()
|
||||
getAnalystStats: await getAnalystStats(),
|
||||
};
|
||||
};
|
||||
@ -1,69 +1,66 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
function secondsUntilEndOfDay() {
|
||||
const now = new Date();
|
||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
||||
const secondsUntilEndOfDay = (endOfDay - now) / 1000;
|
||||
return secondsUntilEndOfDay;
|
||||
const now = new Date();
|
||||
const endOfDay = new Date(
|
||||
now.getFullYear(),
|
||||
now.getMonth(),
|
||||
now.getDate() + 1,
|
||||
);
|
||||
const secondsUntilEndOfDay = (endOfDay - now) / 1000;
|
||||
return secondsUntilEndOfDay;
|
||||
}
|
||||
|
||||
export const POST = (async ({ request, cookies, locals }) => {
|
||||
let output = "error";
|
||||
const data = await request.json();
|
||||
const sentiment = data?.sentiment;
|
||||
const ticker = data?.ticker;
|
||||
const sentimentId = data?.sentimentId;
|
||||
const maxAge = secondsUntilEndOfDay();
|
||||
|
||||
let newData;
|
||||
|
||||
export const POST = (async ( {request, cookies, locals} ) => {
|
||||
|
||||
let output = 'error';
|
||||
const data = await request.json()
|
||||
const sentiment = data?.sentiment;
|
||||
const ticker = data?.ticker
|
||||
const sentimentId = data?.sentimentId;
|
||||
const maxAge = secondsUntilEndOfDay();
|
||||
|
||||
let newData;
|
||||
|
||||
if (cookies?.get('community-sentiment-'+ticker)) {
|
||||
//console.log('already voted')
|
||||
return new Response(JSON.stringify(output))
|
||||
}
|
||||
else {
|
||||
try {
|
||||
if (sentimentId) {
|
||||
if (sentiment === 'upvote') {
|
||||
await locals?.pb?.collection('sentiment').update( sentimentId, {'upvote+': 1})
|
||||
}
|
||||
else if (sentiment === 'downvote') {
|
||||
await locals?.pb?.collection('sentiment').update( sentimentId, {'downvote+': 1})
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
if (sentiment === 'upvote') {
|
||||
newData = await locals?.pb?.collection('sentiment').create({'ticker': ticker, 'upvote': 1})
|
||||
}
|
||||
else if (sentiment === 'downvote') {
|
||||
newData = await locals?.pb?.collection('sentiment').create({'ticker': ticker, 'downvote': 1})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
output = 'success';
|
||||
|
||||
cookies.set('community-sentiment-'+ticker, sentiment, {httpOnly: true,
|
||||
sameSite: 'lax',
|
||||
secure: true,
|
||||
path: '/',
|
||||
maxAge: maxAge // End of day expiry
|
||||
});
|
||||
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
if (cookies?.get("community-sentiment-" + ticker)) {
|
||||
//console.log('already voted')
|
||||
return new Response(JSON.stringify(output));
|
||||
} else {
|
||||
try {
|
||||
if (sentimentId) {
|
||||
if (sentiment === "upvote") {
|
||||
await locals?.pb
|
||||
?.collection("sentiment")
|
||||
.update(sentimentId, { "upvote+": 1 });
|
||||
} else if (sentiment === "downvote") {
|
||||
await locals?.pb
|
||||
?.collection("sentiment")
|
||||
.update(sentimentId, { "downvote+": 1 });
|
||||
}
|
||||
} else {
|
||||
if (sentiment === "upvote") {
|
||||
newData = await locals?.pb
|
||||
?.collection("sentiment")
|
||||
.create({ ticker: ticker, upvote: 1 });
|
||||
} else if (sentiment === "downvote") {
|
||||
newData = await locals?.pb
|
||||
?.collection("sentiment")
|
||||
.create({ ticker: ticker, downvote: 1 });
|
||||
}
|
||||
}
|
||||
|
||||
output = "success";
|
||||
|
||||
cookies.set("community-sentiment-" + ticker, sentiment, {
|
||||
httpOnly: true,
|
||||
sameSite: "lax",
|
||||
secure: true,
|
||||
path: "/",
|
||||
maxAge: maxAge, // End of day expiry
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new Response(JSON.stringify(output))
|
||||
return new Response(JSON.stringify(output));
|
||||
}) satisfies RequestHandler;
|
||||
|
||||
|
||||
@ -1,27 +1,22 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
export const POST = (async ({ request, cookies }) => {
|
||||
let output = "error";
|
||||
const data = await request.json();
|
||||
const consent = data?.consent;
|
||||
try {
|
||||
cookies.set("cookie-consent", consent, {
|
||||
httpOnly: true,
|
||||
sameSite: "lax",
|
||||
secure: true,
|
||||
path: "/",
|
||||
maxAge: 60 * 60 * 24 * 365, // 1 Year consent
|
||||
});
|
||||
|
||||
export const POST = (async ( {request, cookies} ) => {
|
||||
output = "success";
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
let output = 'error';
|
||||
const data = await request.json()
|
||||
const consent = data?.consent;
|
||||
try {
|
||||
|
||||
cookies.set('cookie-consent', consent, {httpOnly: true,
|
||||
sameSite: 'lax',
|
||||
secure: true,
|
||||
path: '/',
|
||||
maxAge: 60*60*24*365 // 1 Year consent
|
||||
});
|
||||
|
||||
output = 'success';
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
|
||||
return new Response(JSON.stringify(output))
|
||||
return new Response(JSON.stringify(output));
|
||||
}) satisfies RequestHandler;
|
||||
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import { serialize } from 'object-to-formdata';
|
||||
import { validateData } from '$lib/utils';
|
||||
import { createCommentTextSchema, createCommentImageSchema } from '$lib/schemas';
|
||||
import { error} from '@sveltejs/kit';
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { serialize } from "object-to-formdata";
|
||||
import { validateData } from "$lib/utils";
|
||||
import {
|
||||
createCommentTextSchema,
|
||||
createCommentImageSchema,
|
||||
} from "$lib/schemas";
|
||||
import { error } from "@sveltejs/kit";
|
||||
//import sharp from 'sharp';
|
||||
//import { marked } from 'marked';
|
||||
|
||||
|
||||
/*
|
||||
export const config = {
|
||||
runtime: 'nodejs20.x',
|
||||
@ -74,35 +76,34 @@ function addClassesToHtml(htmlString) {
|
||||
|
||||
*/
|
||||
|
||||
export const POST = (async ( {request, locals} ) => {
|
||||
export const POST = (async ({ request, locals }) => {
|
||||
let output = "error";
|
||||
|
||||
let output = 'error';
|
||||
const body = await request.formData();
|
||||
|
||||
const body = await request.formData();
|
||||
|
||||
if (body?.get('comment') === 'undefined')
|
||||
{
|
||||
body?.delete('comment');
|
||||
body?.append('comment', '');
|
||||
if (body?.get("comment") === "undefined") {
|
||||
body?.delete("comment");
|
||||
body?.append("comment", "");
|
||||
}
|
||||
|
||||
if (body?.get('reply') === null)
|
||||
{
|
||||
body?.delete('reply');
|
||||
body?.append('reply', '');
|
||||
if (body?.get("reply") === null) {
|
||||
body?.delete("reply");
|
||||
body?.append("reply", "");
|
||||
}
|
||||
|
||||
const {formData, errors} = await validateData( body, body?.get('image')?.length === 0 ? createCommentTextSchema : createCommentImageSchema);
|
||||
|
||||
|
||||
const { formData, errors } = await validateData(
|
||||
body,
|
||||
body?.get("image")?.length === 0
|
||||
? createCommentTextSchema
|
||||
: createCommentImageSchema,
|
||||
);
|
||||
|
||||
if (errors) {
|
||||
return new Response(JSON.stringify(output));
|
||||
}
|
||||
//formData.comment = addClassesToHtml(marked(formData?.comment))
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
if (formData?.image?.type?.includes('image'))
|
||||
{
|
||||
|
||||
@ -136,63 +137,53 @@ const body = await request.formData();
|
||||
}
|
||||
*/
|
||||
|
||||
//Each comment gives the user +1 Karma points
|
||||
//Each comment gives the user +1 Karma points
|
||||
|
||||
await locals.pb.collection("users").update(locals?.user?.id, {
|
||||
"karma+": 1,
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
let newComment;
|
||||
try {
|
||||
newComment = await locals.pb
|
||||
.collection("comments")
|
||||
.create(serialize(formData), {
|
||||
expand: "user,alreadyVoted(comment)",
|
||||
fields:
|
||||
"*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
||||
});
|
||||
|
||||
newComment = await locals.pb.collection('comments').create(serialize(formData), {
|
||||
expand: 'user,alreadyVoted(comment)',
|
||||
fields: "*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
||||
});
|
||||
|
||||
|
||||
|
||||
let postId = formData.post
|
||||
const opPost = await locals.pb.collection('posts').getOne(postId)
|
||||
let postId = formData.post;
|
||||
const opPost = await locals.pb.collection("posts").getOne(postId);
|
||||
//create new record for notifications collections
|
||||
if (locals?.user?.id !== opPost?.user)
|
||||
{
|
||||
let formDataNotifications = new FormData();
|
||||
formDataNotifications.append('opUser', opPost?.user);
|
||||
formDataNotifications.append('user', formData?.user)
|
||||
formDataNotifications.append('post', postId);
|
||||
formDataNotifications.append('comment', newComment?.id)
|
||||
formDataNotifications.append('notifyType', 'comment');
|
||||
|
||||
await locals.pb.collection('notifications').create(formDataNotifications);
|
||||
if (locals?.user?.id !== opPost?.user) {
|
||||
let formDataNotifications = new FormData();
|
||||
formDataNotifications.append("opUser", opPost?.user);
|
||||
formDataNotifications.append("user", formData?.user);
|
||||
formDataNotifications.append("post", postId);
|
||||
formDataNotifications.append("comment", newComment?.id);
|
||||
formDataNotifications.append("notifyType", "comment");
|
||||
|
||||
await locals.pb.collection("notifications").create(formDataNotifications);
|
||||
}
|
||||
|
||||
|
||||
|
||||
let formDataAlreadyVoted = new FormData();
|
||||
formDataAlreadyVoted.append('comment', newComment?.id);
|
||||
formDataAlreadyVoted.append('user', newComment?.user);
|
||||
formDataAlreadyVoted.append('type', 'upvote');
|
||||
formDataAlreadyVoted.append("comment", newComment?.id);
|
||||
formDataAlreadyVoted.append("user", newComment?.user);
|
||||
formDataAlreadyVoted.append("type", "upvote");
|
||||
//console.log(formDataAlreadyVoted)
|
||||
await locals.pb.collection('alreadyVoted').create(formDataAlreadyVoted);
|
||||
|
||||
//User always upvotes their comment in the intial state
|
||||
await locals.pb.collection("comments").update(newComment?.id, {
|
||||
"upvote+": 1,
|
||||
})
|
||||
|
||||
|
||||
output = 'success';
|
||||
await locals.pb.collection("alreadyVoted").create(formDataAlreadyVoted);
|
||||
|
||||
//User always upvotes their comment in the intial state
|
||||
await locals.pb.collection("comments").update(newComment?.id, {
|
||||
"upvote+": 1,
|
||||
});
|
||||
|
||||
output = "success";
|
||||
} catch (err) {
|
||||
console.log('Error: ', err);
|
||||
console.log("Error: ", err);
|
||||
error(err.status, err.message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new Response(JSON.stringify([output, newComment]));
|
||||
return new Response(JSON.stringify([output, newComment]));
|
||||
}) satisfies RequestHandler;
|
||||
@ -1,50 +1,47 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import { serialize } from 'object-to-formdata';
|
||||
import { validateData } from '$lib/utils';
|
||||
import { updateCommentTextSchema} from '$lib/schemas';
|
||||
import { error} from '@sveltejs/kit';
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { serialize } from "object-to-formdata";
|
||||
import { validateData } from "$lib/utils";
|
||||
import { updateCommentTextSchema } from "$lib/schemas";
|
||||
import { error } from "@sveltejs/kit";
|
||||
|
||||
export const POST = (async ({ request, locals }) => {
|
||||
let output = "error";
|
||||
|
||||
export const POST = (async ( {request, locals} ) => {
|
||||
const body = await request.formData();
|
||||
const commentId = body?.get("commentId");
|
||||
|
||||
let output = 'error';
|
||||
|
||||
const body = await request.formData();
|
||||
const commentId = body?.get('commentId');
|
||||
|
||||
if (body?.get('comment') === 'undefined')
|
||||
{
|
||||
body?.delete('comment');
|
||||
body?.append('comment', '');
|
||||
if (body?.get("comment") === "undefined") {
|
||||
body?.delete("comment");
|
||||
body?.append("comment", "");
|
||||
}
|
||||
|
||||
const {formData, errors} = await validateData( body, updateCommentTextSchema);
|
||||
console.log(error)
|
||||
const { formData, errors } = await validateData(
|
||||
body,
|
||||
updateCommentTextSchema,
|
||||
);
|
||||
console.log(error);
|
||||
|
||||
if (errors) {
|
||||
|
||||
return new Response(JSON.stringify(output));
|
||||
}
|
||||
|
||||
|
||||
let updateComment;
|
||||
try {
|
||||
updateComment = await locals.pb
|
||||
.collection("comments")
|
||||
.update(commentId, serialize(formData));
|
||||
|
||||
updateComment = await locals.pb.collection('comments').update(commentId,serialize(formData));
|
||||
|
||||
updateComment = await locals.pb.collection('comments').getOne(commentId, {
|
||||
expand: 'user,alreadyVoted(comment)',
|
||||
fields: "*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
||||
});
|
||||
|
||||
output = 'success';
|
||||
updateComment = await locals.pb.collection("comments").getOne(commentId, {
|
||||
expand: "user,alreadyVoted(comment)",
|
||||
fields:
|
||||
"*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
||||
});
|
||||
|
||||
output = "success";
|
||||
} catch (err) {
|
||||
console.log('Error: ', err);
|
||||
console.log("Error: ", err);
|
||||
error(err.status, err.message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new Response(JSON.stringify([output, updateComment]));
|
||||
return new Response(JSON.stringify([output, updateComment]));
|
||||
}) satisfies RequestHandler;
|
||||
@ -1,69 +1,82 @@
|
||||
import { promises as fsPromises } from 'fs';
|
||||
import fs from 'fs';
|
||||
import fetch from 'node-fetch';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { promises as fsPromises } from "fs";
|
||||
import fs from "fs";
|
||||
import fetch from "node-fetch";
|
||||
import type { RequestHandler } from "@sveltejs/kit";
|
||||
|
||||
const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB in bytes
|
||||
|
||||
const parseRange = (range: string) => {
|
||||
const [start, end] = range.replace(/bytes=/, '').split('-').map(Number);
|
||||
return { start, end: end || undefined };
|
||||
const [start, end] = range
|
||||
.replace(/bytes=/, "")
|
||||
.split("-")
|
||||
.map(Number);
|
||||
return { start, end: end || undefined };
|
||||
};
|
||||
|
||||
const createResponse = (body: ReadableStream | Buffer, headers: Record<string, string>, status = 206) =>
|
||||
new Response(body, { status, headers });
|
||||
const createResponse = (
|
||||
body: ReadableStream | Buffer,
|
||||
headers: Record<string, string>,
|
||||
status = 206,
|
||||
) => new Response(body, { status, headers });
|
||||
|
||||
const streamRemoteFile = async (url: string, range: string) => {
|
||||
const { start, end } = parseRange(range);
|
||||
const response = await fetch(url, {
|
||||
headers: { Range: `bytes=${start}-${end || ''}` }
|
||||
});
|
||||
const { start, end } = parseRange(range);
|
||||
const response = await fetch(url, {
|
||||
headers: { Range: `bytes=${start}-${end || ""}` },
|
||||
});
|
||||
|
||||
return createResponse(response.body, {
|
||||
'Content-Range': response.headers.get('Content-Range') || '',
|
||||
'Accept-Ranges': 'bytes',
|
||||
'Content-Length': response.headers.get('Content-Length') || '',
|
||||
'Content-Type': response.headers.get('Content-Type') || '',
|
||||
});
|
||||
return createResponse(response.body, {
|
||||
"Content-Range": response.headers.get("Content-Range") || "",
|
||||
"Accept-Ranges": "bytes",
|
||||
"Content-Length": response.headers.get("Content-Length") || "",
|
||||
"Content-Type": response.headers.get("Content-Type") || "",
|
||||
});
|
||||
};
|
||||
|
||||
const streamLocalFile = async (filePath: string, range: string) => {
|
||||
const fileSize = (await fsPromises.stat(filePath)).size;
|
||||
const { start, end } = parseRange(range);
|
||||
const chunkEnd = end || Math.min(start + CHUNK_SIZE - 1, fileSize - 1);
|
||||
const fileSize = (await fsPromises.stat(filePath)).size;
|
||||
const { start, end } = parseRange(range);
|
||||
const chunkEnd = end || Math.min(start + CHUNK_SIZE - 1, fileSize - 1);
|
||||
|
||||
if (start >= fileSize) {
|
||||
return new Response(`Requested range not satisfiable\n${start} >= ${fileSize}`, {
|
||||
status: 416,
|
||||
headers: { 'Content-Range': `bytes */${fileSize}` },
|
||||
});
|
||||
}
|
||||
if (start >= fileSize) {
|
||||
return new Response(
|
||||
`Requested range not satisfiable\n${start} >= ${fileSize}`,
|
||||
{
|
||||
status: 416,
|
||||
headers: { "Content-Range": `bytes */${fileSize}` },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const stream = fs.createReadStream(filePath, { start, end: chunkEnd });
|
||||
const stream = fs.createReadStream(filePath, { start, end: chunkEnd });
|
||||
|
||||
return createResponse(stream, {
|
||||
'Content-Range': `bytes ${start}-${chunkEnd}/${fileSize}`,
|
||||
'Accept-Ranges': 'bytes',
|
||||
'Content-Length': (chunkEnd - start + 1).toString(),
|
||||
'Content-Type': 'video/mp4',
|
||||
});
|
||||
return createResponse(stream, {
|
||||
"Content-Range": `bytes ${start}-${chunkEnd}/${fileSize}`,
|
||||
"Accept-Ranges": "bytes",
|
||||
"Content-Length": (chunkEnd - start + 1).toString(),
|
||||
"Content-Type": "video/mp4",
|
||||
});
|
||||
};
|
||||
|
||||
export const GET: RequestHandler = async ({ params, request }) => {
|
||||
const { filename } = params;
|
||||
const range = request.headers.get('range');
|
||||
const { filename } = params;
|
||||
const range = request.headers.get("range");
|
||||
|
||||
if (!range) {
|
||||
return new Response('Requires Range header', { status: 400 });
|
||||
}
|
||||
if (!range) {
|
||||
return new Response("Requires Range header", { status: 400 });
|
||||
}
|
||||
|
||||
try {
|
||||
const videoPath = filename.startsWith('http') ? filename : `static/${filename}`;
|
||||
return filename.startsWith('http') ?
|
||||
await streamRemoteFile(videoPath, range) :
|
||||
await streamLocalFile(videoPath, range);
|
||||
} catch (error) {
|
||||
console.error('Error streaming video:', error);
|
||||
return new Response('File not found or error streaming video', { status: 404 });
|
||||
}
|
||||
try {
|
||||
const videoPath = filename.startsWith("http")
|
||||
? filename
|
||||
: `static/${filename}`;
|
||||
return filename.startsWith("http")
|
||||
? await streamRemoteFile(videoPath, range)
|
||||
: await streamLocalFile(videoPath, range);
|
||||
} catch (error) {
|
||||
console.error("Error streaming video:", error);
|
||||
return new Response("File not found or error streaming video", {
|
||||
status: 404,
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -1,25 +1,23 @@
|
||||
import { pb } from "$lib/pocketbase";
|
||||
import { getCache, setCache } from '$lib/store';
|
||||
import { getCache, setCache } from "$lib/store";
|
||||
|
||||
|
||||
export const load = async ({parent}) => {
|
||||
export const load = async ({ parent }) => {
|
||||
const getAllBlogPost = async () => {
|
||||
let output;
|
||||
console.log(await parent())
|
||||
console.log(await parent());
|
||||
// Get cached data for the specific tickerID
|
||||
const cachedData = getCache('allBlogPost', 'getAllBlogPost');
|
||||
const cachedData = getCache("allBlogPost", "getAllBlogPost");
|
||||
if (cachedData) {
|
||||
output = cachedData;
|
||||
} else {
|
||||
|
||||
// make the POST request to the endpoint
|
||||
output = await pb.collection('articles').getFullList({
|
||||
expand: 'user',
|
||||
sort: '-created'
|
||||
})
|
||||
output = await pb.collection("articles").getFullList({
|
||||
expand: "user",
|
||||
sort: "-created",
|
||||
});
|
||||
|
||||
// Cache the data for this specific tickerID with a specific name 'getAllBlogPost'
|
||||
setCache('allBlogPost', output, 'getAllBlogPost');
|
||||
setCache("allBlogPost", output, "getAllBlogPost");
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -27,6 +25,6 @@ export const load = async ({parent}) => {
|
||||
|
||||
// Make sure to return a promise
|
||||
return {
|
||||
getAllBlogPost: await getAllBlogPost()
|
||||
getAllBlogPost: await getAllBlogPost(),
|
||||
};
|
||||
};
|
||||
@ -1,22 +1,22 @@
|
||||
import { pb } from "$lib/pocketbase";
|
||||
import { getCache, setCache } from '$lib/store';
|
||||
|
||||
import { getCache, setCache } from "$lib/store";
|
||||
|
||||
export const load = async ({ params }) => {
|
||||
const getArticle = async () => {
|
||||
let output;
|
||||
|
||||
// Get cached data for the specific tickerID
|
||||
const cachedData = getCache(params?.slug, 'getArticle');
|
||||
const cachedData = getCache(params?.slug, "getArticle");
|
||||
if (cachedData) {
|
||||
output = cachedData;
|
||||
} else {
|
||||
|
||||
// make the POST request to the endpoint
|
||||
output = await pb?.collection('articles')?.getOne(params?.slug, {expand: 'user'})
|
||||
output = await pb
|
||||
?.collection("articles")
|
||||
?.getOne(params?.slug, { expand: "user" });
|
||||
|
||||
// Cache the data for this specific tickerID with a specific name 'getArticle'
|
||||
setCache(params?.slug, output, 'getArticle');
|
||||
setCache(params?.slug, output, "getArticle");
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -47,7 +47,6 @@ const getDiscordWidget = async () => {
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
// Make sure to return a promise
|
||||
return {
|
||||
getArticle: await getArticle(),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user