add sentry
This commit is contained in:
parent
c7cd229cae
commit
4d74e55265
13
README.md
13
README.md
@ -1,7 +1,5 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# **Open Source Stock Analysis for Data Freaks**
|
# **Open Source Stock Analysis for Data Freaks**
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
@ -14,30 +12,35 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Techstack
|
# Techstack
|
||||||
|
|
||||||
This is the codebase that powers [stocknear's](https://stocknear.com/) frontend, which is an open-source stock analysis & community platform.
|
This is the codebase that powers [stocknear's](https://stocknear.com/) frontend, which is an open-source stock analysis & community platform.
|
||||||
|
|
||||||
Built with:
|
Built with:
|
||||||
|
|
||||||
- [Sveltekit](https://kit.svelte.dev/): Frontend
|
- [Sveltekit](https://kit.svelte.dev/): Frontend
|
||||||
- [Tailwindcss](https://tailwindcss.com/): Styling
|
- [Tailwindcss](https://tailwindcss.com/): Styling
|
||||||
- [DaisyUI](https://daisyui.com/): Styling
|
- [DaisyUI](https://daisyui.com/): Styling
|
||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
Coming soon to run stocknear locally on your machine.
|
Coming soon to run stocknear locally on your machine.
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
Stocknear is open-source software and you're welcome to contribute to its development.
|
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:
|
If want to contribute to the codebase please follow these guidelines:
|
||||||
|
|
||||||
- Refactoring slow code into fast code is a huge plus!
|
- Refactoring slow code into fast code is a huge plus!
|
||||||
- Reducing complexity and increasing simplicity/readability 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.
|
- 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 ❤️
|
# Support ❤️
|
||||||
|
|
||||||
If you love the idea of stocknear and want to support our mission you can help us in two ways:
|
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.
|
- 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!
|
- You can donate money via [Ko-fi](https://ko-fi.com/stocknear) to help us pay the servers & data providers to keep everything running!
|
||||||
|
|||||||
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": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.556.0",
|
"@aws-sdk/client-s3": "^3.556.0",
|
||||||
|
"@sentry/sveltekit": "^8.30.0",
|
||||||
"greeks": "^1.0.0",
|
"greeks": "^1.0.0",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"https": "^1.0.0",
|
"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({
|
export default defineConfig({
|
||||||
testDir: 'tests',
|
testDir: "tests",
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: 'chromium',
|
name: "chromium",
|
||||||
use: {
|
use: {
|
||||||
...devices['Desktop Chrome'],
|
...devices["Desktop Chrome"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'safari',
|
name: "safari",
|
||||||
use: {
|
use: {
|
||||||
...devices['Iphone 6'],
|
...devices["Iphone 6"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
|
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|||||||
113
src/app.css
113
src/app.css
@ -2,10 +2,6 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
@apply text-left text-sm rtl:text-right;
|
@apply text-left text-sm rtl:text-right;
|
||||||
:where(th, td) {
|
:where(th, td) {
|
||||||
@ -45,7 +41,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@layer utilities {
|
@layer utilities {
|
||||||
.no-scrollbar {
|
.no-scrollbar {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
@ -69,7 +64,6 @@
|
|||||||
-ms-overflow-style: -ms-autohiding-scrollbar;
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.shake-ticker:hover img {
|
.shake-ticker:hover img {
|
||||||
animation-name: shake;
|
animation-name: shake;
|
||||||
animation-duration: 0.5s;
|
animation-duration: 0.5s;
|
||||||
@ -77,76 +71,79 @@
|
|||||||
animation-timing-function: ease-in-out;
|
animation-timing-function: ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes shake {
|
@keyframes shake {
|
||||||
0% { transform: rotate(0deg); }
|
0% {
|
||||||
25% { transform: rotate(10deg); }
|
transform: rotate(0deg);
|
||||||
50% { transform: rotate(0deg); }
|
}
|
||||||
75% { transform: rotate(-10deg); }
|
25% {
|
||||||
100% { transform: rotate(0deg); }
|
transform: rotate(10deg);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
75% {
|
||||||
|
transform: rotate(-10deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.loader,
|
.loader,
|
||||||
.loader:before,
|
.loader:before,
|
||||||
.loader:after {
|
.loader:after {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
width: 2.5em;
|
width: 2.5em;
|
||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
-webkit-animation-fill-mode: both;
|
-webkit-animation-fill-mode: both;
|
||||||
animation-fill-mode: both;
|
animation-fill-mode: both;
|
||||||
-webkit-animation: load7 0.8s infinite ease-in-out;
|
-webkit-animation: load7 0.8s infinite ease-in-out;
|
||||||
animation: load7 0.8s infinite ease-in-out;
|
animation: load7 0.8s infinite ease-in-out;
|
||||||
}
|
}
|
||||||
.loader {
|
.loader {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin: 80px auto;
|
margin: 80px auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-indent: -9999em;
|
text-indent: -9999em;
|
||||||
-webkit-transform: translateZ(0);
|
-webkit-transform: translateZ(0);
|
||||||
-ms-transform: translateZ(0);
|
-ms-transform: translateZ(0);
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
-webkit-animation-delay: -0.16s;
|
-webkit-animation-delay: -0.16s;
|
||||||
animation-delay: -0.16s;
|
animation-delay: -0.16s;
|
||||||
}
|
}
|
||||||
.loader:before,
|
.loader:before,
|
||||||
.loader:after {
|
.loader:after {
|
||||||
content: '';
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
.loader:before {
|
.loader:before {
|
||||||
left: -3.5em;
|
left: -3.5em;
|
||||||
-webkit-animation-delay: -0.32s;
|
-webkit-animation-delay: -0.32s;
|
||||||
animation-delay: -0.32s;
|
animation-delay: -0.32s;
|
||||||
}
|
}
|
||||||
.loader:after {
|
.loader:after {
|
||||||
left: 3.5em;
|
left: 3.5em;
|
||||||
}
|
}
|
||||||
@-webkit-keyframes load7 {
|
@-webkit-keyframes load7 {
|
||||||
0%,
|
0%,
|
||||||
80%,
|
80%,
|
||||||
100% {
|
100% {
|
||||||
box-shadow: 0 2.5em 0 -1.3em;
|
box-shadow: 0 2.5em 0 -1.3em;
|
||||||
}
|
}
|
||||||
40% {
|
40% {
|
||||||
box-shadow: 0 2.5em 0 0;
|
box-shadow: 0 2.5em 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@keyframes load7 {
|
@keyframes load7 {
|
||||||
0%,
|
0%,
|
||||||
80%,
|
80%,
|
||||||
100% {
|
100% {
|
||||||
box-shadow: 0 2.5em 0 -1.3em;
|
box-shadow: 0 2.5em 0 -1.3em;
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
box-shadow: 0 2.5em 0 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
40% {
|
|
||||||
box-shadow: 0 2.5em 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
1
src/app.d.ts
vendored
1
src/app.d.ts
vendored
@ -8,7 +8,6 @@ declare namespace App {
|
|||||||
// interface Platform {}
|
// interface Platform {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// src/app.d.ts
|
// src/app.d.ts
|
||||||
/*
|
/*
|
||||||
import PocketBase from "pocketbase";
|
import PocketBase from "pocketbase";
|
||||||
|
|||||||
15
src/app.html
15
src/app.html
@ -1,22 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
|
|
||||||
<html lang="en" class="bg-[#09090B]">
|
<html lang="en" class="bg-[#09090B]">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
<link rel="manifest" href="%sveltekit.assets%/manifest.json" />
|
<link rel="manifest" href="%sveltekit.assets%/manifest.json" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<!-- Global background color -->
|
<!-- Global background color -->
|
||||||
<body data-sveltekit-preload-data="hover" class="bg-[#09090B] overflow-x-hidden">
|
<body
|
||||||
|
data-sveltekit-preload-data="hover"
|
||||||
|
class="bg-[#09090B] overflow-x-hidden"
|
||||||
|
>
|
||||||
<div>%sveltekit.body%</div>
|
<div>%sveltekit.body%</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,4 +69,3 @@
|
|||||||
--radius: 0.5rem;
|
--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,7 +1,16 @@
|
|||||||
|
import { sequence } from "@sveltejs/kit/hooks";
|
||||||
|
import * as Sentry from "@sentry/sveltekit";
|
||||||
import PocketBase from "pocketbase";
|
import PocketBase from "pocketbase";
|
||||||
import { serializeNonPOJOs } from "$lib/utils";
|
import { serializeNonPOJOs } from "$lib/utils";
|
||||||
|
|
||||||
export const handle = async ({ event, resolve }) => {
|
Sentry.init({
|
||||||
|
dsn: import.meta.env.VITE_SENTRY,
|
||||||
|
tracesSampleRate: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handle = sequence(
|
||||||
|
Sentry.sentryHandle(),
|
||||||
|
async ({ event, resolve }) => {
|
||||||
// Use optional chaining and nullish coalescing for safer property access
|
// Use optional chaining and nullish coalescing for safer property access
|
||||||
const regionHeader =
|
const regionHeader =
|
||||||
event?.request?.headers?.get("x-vercel-id") ??
|
event?.request?.headers?.get("x-vercel-id") ??
|
||||||
@ -72,4 +81,6 @@ export const handle = async ({ event, resolve }) => {
|
|||||||
response.headers.append("set-cookie", cookieString);
|
response.headers.append("set-cookie", cookieString);
|
||||||
|
|
||||||
return response;
|
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', () => {
|
describe("sum test", () => {
|
||||||
it('adds 1 + 2 to equal 3', () => {
|
it("adds 1 + 2 to equal 3", () => {
|
||||||
expect(1 + 2).toBe(3);
|
expect(1 + 2).toBe(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,21 +1,26 @@
|
|||||||
.driver-active .driver-overlay, .driver-active * {
|
.driver-active .driver-overlay,
|
||||||
|
.driver-active * {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.driver-active .driver-active-element, .driver-active .driver-active-element *, .driver-popover, .driver-popover * {
|
.driver-active .driver-active-element,
|
||||||
|
.driver-active .driver-active-element *,
|
||||||
|
.driver-popover,
|
||||||
|
.driver-popover * {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
@keyframes animate-fade-in {
|
@keyframes animate-fade-in {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.driver-fade .driver-overlay {
|
.driver-fade .driver-overlay {
|
||||||
animation: animate-fade-in .2s ease-in-out;
|
animation: animate-fade-in 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
.driver-fade .driver-popover {
|
.driver-fade .driver-popover {
|
||||||
animation: animate-fade-in .2s;
|
animation: animate-fade-in 0.2s;
|
||||||
}
|
}
|
||||||
.driver-popover {
|
.driver-popover {
|
||||||
all: unset;
|
all: unset;
|
||||||
@ -34,10 +39,17 @@ to {
|
|||||||
background-color: #202327;
|
background-color: #202327;
|
||||||
}
|
}
|
||||||
.driver-popover * {
|
.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 {
|
.driver-popover-title {
|
||||||
font: 19px/normal sans-serif;
|
font: 19px / normal sans-serif;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -59,17 +71,18 @@ to {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: color;
|
transition: color;
|
||||||
transition-duration: .2s;
|
transition-duration: 0.2s;
|
||||||
}
|
}
|
||||||
.driver-popover-close-btn:hover, .driver-popover-close-btn:focus {
|
.driver-popover-close-btn:hover,
|
||||||
|
.driver-popover-close-btn:focus {
|
||||||
color: #2d2d2d;
|
color: #2d2d2d;
|
||||||
}
|
}
|
||||||
.driver-popover-title[style*=block]+.driver-popover-description {
|
.driver-popover-title[style*="block"] + .driver-popover-description {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.driver-popover-description {
|
.driver-popover-description {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font: 16px/normal sans-serif;
|
font: 16px / normal sans-serif;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
zoom: 1;
|
zoom: 1;
|
||||||
@ -97,7 +110,7 @@ to {
|
|||||||
text-shadow: 1px 1px 0 #fff;
|
text-shadow: 1px 1px 0 #fff;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #2d2d2d;
|
color: #2d2d2d;
|
||||||
font: 14px/normal sans-serif;
|
font: 14px / normal sans-serif;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
zoom: 1;
|
zoom: 1;
|
||||||
@ -106,16 +119,18 @@ to {
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.driver-popover-footer .driver-popover-btn-disabled {
|
.driver-popover-footer .driver-popover-btn-disabled {
|
||||||
opacity: .5;
|
opacity: 0.5;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
:not(body):has(>.driver-active-element) {
|
:not(body):has(> .driver-active-element) {
|
||||||
overflow: hidden!important;
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
.driver-no-interaction, .driver-no-interaction * {
|
.driver-no-interaction,
|
||||||
pointer-events: none!important;
|
.driver-no-interaction * {
|
||||||
|
pointer-events: none !important;
|
||||||
}
|
}
|
||||||
.driver-popover-footer button:hover, .driver-popover-footer button:focus {
|
.driver-popover-footer button:hover,
|
||||||
|
.driver-popover-footer button:focus {
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
}
|
}
|
||||||
.driver-popover-navigation-btns {
|
.driver-popover-navigation-btns {
|
||||||
@ -123,7 +138,7 @@ to {
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
.driver-popover-navigation-btns button+button {
|
.driver-popover-navigation-btns button + button {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow {
|
.driver-popover-arrow {
|
||||||
@ -161,23 +176,29 @@ to {
|
|||||||
.driver-popover-arrow-side-center {
|
.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 {
|
.driver-popover-arrow-side-left.driver-popover-arrow-align-start,
|
||||||
|
.driver-popover-arrow-side-right.driver-popover-arrow-align-start {
|
||||||
top: 15px;
|
top: 15px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-start, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-start {
|
.driver-popover-arrow-side-top.driver-popover-arrow-align-start,
|
||||||
|
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-start {
|
||||||
left: 15px;
|
left: 15px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow-align-end.driver-popover-arrow-side-left, .driver-popover-arrow-align-end.driver-popover-arrow-side-right {
|
.driver-popover-arrow-align-end.driver-popover-arrow-side-left,
|
||||||
|
.driver-popover-arrow-align-end.driver-popover-arrow-side-right {
|
||||||
bottom: 15px;
|
bottom: 15px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-end, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-end {
|
.driver-popover-arrow-side-top.driver-popover-arrow-align-end,
|
||||||
|
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-end {
|
||||||
right: 15px;
|
right: 15px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow-side-left.driver-popover-arrow-align-center, .driver-popover-arrow-side-right.driver-popover-arrow-align-center {
|
.driver-popover-arrow-side-left.driver-popover-arrow-align-center,
|
||||||
|
.driver-popover-arrow-side-right.driver-popover-arrow-align-center {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
margin-top: -5px;
|
margin-top: -5px;
|
||||||
}
|
}
|
||||||
.driver-popover-arrow-side-top.driver-popover-arrow-align-center, .driver-popover-arrow-side-bottom.driver-popover-arrow-align-center {
|
.driver-popover-arrow-side-top.driver-popover-arrow-align-center,
|
||||||
|
.driver-popover-arrow-side-bottom.driver-popover-arrow-align-center {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -5px;
|
margin-left: -5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,7 +5,8 @@ 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",
|
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: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
default:
|
||||||
|
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
||||||
secondary:
|
secondary:
|
||||||
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||||
destructive:
|
destructive:
|
||||||
|
|||||||
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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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)
|
* 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 {
|
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;
|
line-height: 1.4;
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
}
|
}
|
||||||
@ -31,12 +32,12 @@ code {
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 0.1rem 0.2rem;
|
padding: 0.1rem 0.2rem;
|
||||||
}
|
}
|
||||||
.mce-content-body:not([dir=rtl]) blockquote {
|
.mce-content-body:not([dir="rtl"]) blockquote {
|
||||||
border-left: 2px solid #ccc;
|
border-left: 2px solid #ccc;
|
||||||
margin-left: 1.5rem;
|
margin-left: 1.5rem;
|
||||||
padding-left: 1rem;
|
padding-left: 1rem;
|
||||||
}
|
}
|
||||||
.mce-content-body[dir=rtl] blockquote {
|
.mce-content-body[dir="rtl"] blockquote {
|
||||||
border-right: 2px solid #ccc;
|
border-right: 2px solid #ccc;
|
||||||
margin-right: 1.5rem;
|
margin-right: 1.5rem;
|
||||||
padding-right: 1rem;
|
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,17 +1,16 @@
|
|||||||
import PocketBase from 'pocketbase';
|
import PocketBase from "pocketbase";
|
||||||
import { userRegion } from '$lib/store';
|
import { userRegion } from "$lib/store";
|
||||||
|
|
||||||
const usRegion = ['cle1','iad1','pdx1','sfo1'];
|
const usRegion = ["cle1", "iad1", "pdx1", "sfo1"];
|
||||||
|
|
||||||
let pbUrl;
|
let pbUrl;
|
||||||
|
|
||||||
userRegion.subscribe(value => {
|
userRegion.subscribe((value) => {
|
||||||
|
|
||||||
if (usRegion?.includes(value)) {
|
if (usRegion?.includes(value)) {
|
||||||
pbUrl = import.meta.env.VITE_USEAST_POCKETBASE_URL;
|
pbUrl = import.meta.env.VITE_USEAST_POCKETBASE_URL;
|
||||||
} else {
|
} else {
|
||||||
pbUrl = import.meta.env.VITE_EU_POCKETBASE_URL;
|
pbUrl = import.meta.env.VITE_EU_POCKETBASE_URL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const pb = new PocketBase(pbUrl);
|
export const pb = new PocketBase(pbUrl);
|
||||||
|
|||||||
@ -1,98 +1,106 @@
|
|||||||
import { z } from 'zod';
|
import { z } from "zod";
|
||||||
|
|
||||||
export const loginUserSchema = z.object({
|
export const loginUserSchema = z.object({
|
||||||
email: z
|
email: z
|
||||||
.string({ required_error: 'Email is required' })
|
.string({ required_error: "Email is required" })
|
||||||
.email({ message: 'Email must be a valid email.' }),
|
.email({ message: "Email must be a valid email." }),
|
||||||
password: z.string({ required_error: 'Password is required' })
|
password: z.string({ required_error: "Password is required" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const registerUserSchema = z
|
export const registerUserSchema = z
|
||||||
.object({
|
.object({
|
||||||
username: z
|
username: z
|
||||||
.string({ required_error: 'Username is required' })
|
.string({ required_error: "Username is required" })
|
||||||
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, { message: 'Username can only contain letters, numbers, and special characters.' }) // Updated regex pattern
|
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, {
|
||||||
.min(3, { message: 'Username must be at least 2 characters' })
|
message:
|
||||||
.max(64, { message: 'Username must be less than 64 characters' })
|
"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(),
|
.trim(),
|
||||||
email: z
|
email: z
|
||||||
.string({ required_error: 'Email is required' })
|
.string({ required_error: "Email is required" })
|
||||||
.email({ message: 'Email must be a valid email' }),
|
.email({ message: "Email must be a valid email" }),
|
||||||
password: z
|
password: z
|
||||||
.string({ required_error: 'Password is required' })
|
.string({ required_error: "Password is required" })
|
||||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
.regex(
|
||||||
|
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||||
|
{
|
||||||
message:
|
message:
|
||||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
passwordConfirm: z
|
passwordConfirm: z
|
||||||
.string({ required_error: 'Confirm Password is required' })
|
.string({ required_error: "Confirm Password is required" })
|
||||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
.regex(
|
||||||
|
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||||
|
{
|
||||||
message:
|
message:
|
||||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||||
})
|
},
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||||
if (passwordConfirm !== password) {
|
if (passwordConfirm !== password) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Password & Confirm password must match',
|
message: "Password & Confirm password must match",
|
||||||
path: ['password']
|
path: ["password"],
|
||||||
});
|
});
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Password & Confirm password must match',
|
message: "Password & Confirm password must match",
|
||||||
path: ['passwordConfirm']
|
path: ["passwordConfirm"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const createPostTextSchema = z.object({
|
export const createPostTextSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title is required' })
|
.string({ required_error: "Title is required" })
|
||||||
.min(1, { message: 'Title is required' })
|
.min(1, { message: "Title is required" })
|
||||||
.max(300, { message: 'Title must be 300 characters or less' })
|
.max(300, { message: "Title must be 300 characters or less" })
|
||||||
.trim(),
|
.trim(),
|
||||||
|
|
||||||
//url: z.string().optional().url({ message: 'URL must be a valid URL' }),
|
//url: z.string().optional().url({ message: 'URL must be a valid URL' }),
|
||||||
tagline: z.string(),
|
tagline: z.string(),
|
||||||
tagTopic: z.string(),
|
tagTopic: z.string(),
|
||||||
atLeastOneTag: z.string({ required_error: 'At least 1 tag is required' })
|
atLeastOneTag: z
|
||||||
.min(1, { message: 'At least 1 tag is required' }),
|
.string({ required_error: "At least 1 tag is required" })
|
||||||
|
.min(1, { message: "At least 1 tag is required" }),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
postType: z.string({ required_error: 'PostType is required.' }),
|
postType: z.string({ required_error: "PostType is required." }),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
});
|
});
|
||||||
|
|
||||||
const imageTypes = [
|
const imageTypes = [
|
||||||
'image/jpeg',
|
"image/jpeg",
|
||||||
'image/jpg',
|
"image/jpg",
|
||||||
'image/png',
|
"image/png",
|
||||||
'image/webp',
|
"image/webp",
|
||||||
'image/svg+xml',
|
"image/svg+xml",
|
||||||
'image/gif'
|
"image/gif",
|
||||||
];
|
];
|
||||||
|
|
||||||
const videoTypes = ['video/mp4', 'video/gif'];
|
const videoTypes = ["video/mp4", "video/gif"];
|
||||||
|
|
||||||
export const createPostImageSchema = z.object({
|
export const createPostImageSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title is required' })
|
.string({ required_error: "Title is required" })
|
||||||
.min(1, { message: 'Title is required' })
|
.min(1, { message: "Title is required" })
|
||||||
.max(300, { message: 'Title must be 300 characters or less' })
|
.max(300, { message: "Title must be 300 characters or less" })
|
||||||
.trim(),
|
.trim(),
|
||||||
tagTopic: z.string(),
|
tagTopic: z.string(),
|
||||||
tagline: 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' }),
|
atLeastOneTag: z
|
||||||
thumbnail: z
|
.string({ required_error: "At least 1 tag is required" })
|
||||||
.instanceof(File)
|
.min(1, { message: "At least 1 tag is required" }),
|
||||||
.superRefine((val, ctx) => {
|
thumbnail: z.instanceof(File).superRefine((val, ctx) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
if (val.size > 5121440) {
|
if (val.size > 5121440) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'File must be less than 5MB',
|
message: "File must be less than 5MB",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,28 +112,27 @@ export const createPostImageSchema = z.object({
|
|||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message:
|
message:
|
||||||
'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg',
|
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
postType: z.string({ required_error: 'PostType is required.' }),
|
postType: z.string({ required_error: "PostType is required." }),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const createPostLinkSchema = z.object({
|
export const createPostLinkSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title is required' })
|
.string({ required_error: "Title is required" })
|
||||||
.min(1, { message: 'Title is required' })
|
.min(1, { message: "Title is required" })
|
||||||
.max(300, { message: 'Title must be 300 characters or less' })
|
.max(300, { message: "Title must be 300 characters or less" })
|
||||||
.trim(),
|
.trim(),
|
||||||
tagTopic: z.string(),
|
tagTopic: z.string(),
|
||||||
tagline: z.string(),
|
tagline: z.string(),
|
||||||
atLeastOneTag: z.string({ required_error: 'At least 1 tag is required' })
|
atLeastOneTag: z
|
||||||
.min(1, { message: 'At least 1 tag is required' }),
|
.string({ required_error: "At least 1 tag is required" })
|
||||||
link: z.string().url({ message: 'URL must be a valid URL' }),
|
.min(1, { message: "At least 1 tag is required" }),
|
||||||
|
link: z.string().url({ message: "URL must be a valid URL" }),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
/*
|
/*
|
||||||
thumbnail: z
|
thumbnail: z
|
||||||
@ -148,14 +155,12 @@ export const createPostLinkSchema = z.object({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
*/
|
*/
|
||||||
postType: z.string({ required_error: 'PostType is required.' }),
|
postType: z.string({ required_error: "PostType is required." }),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//export const updatePostSchema = createPostSchema.omit({ user: true });
|
//export const updatePostSchema = createPostSchema.omit({ user: true });
|
||||||
|
|
||||||
|
|
||||||
export const updatePersonalDataSchema = z.object({
|
export const updatePersonalDataSchema = z.object({
|
||||||
/*
|
/*
|
||||||
email: z
|
email: z
|
||||||
@ -163,63 +168,73 @@ export const updatePersonalDataSchema = z.object({
|
|||||||
.email({ message: 'Email must be a valid email' }),
|
.email({ message: 'Email must be a valid email' }),
|
||||||
*/
|
*/
|
||||||
username: z
|
username: z
|
||||||
.string({ required_error: 'Username is required' })
|
.string({ required_error: "Username is required" })
|
||||||
.min(2, { message: 'Username must be at least 2 characters' })
|
.min(2, { message: "Username must be at least 2 characters" })
|
||||||
.max(24, { message: 'Username must be 24 characters or less' })
|
.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
|
.regex(/^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/, {
|
||||||
});
|
message:
|
||||||
|
"Username can only contain letters, numbers, and special characters.",
|
||||||
|
}), // Updated regex pattern
|
||||||
|
});
|
||||||
|
|
||||||
export const updateEmailSchema = z.object({
|
export const updateEmailSchema = z.object({
|
||||||
email: z
|
email: z
|
||||||
.string({ required_error: 'Email is required' })
|
.string({ required_error: "Email is required" })
|
||||||
.email({ message: 'Email must be a valid email' })
|
.email({ message: "Email must be a valid email" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateUsernameSchema = z.object({
|
export const updateUsernameSchema = z.object({
|
||||||
username: z
|
username: z
|
||||||
.string({ required_error: 'Username is required' })
|
.string({ required_error: "Username is required" })
|
||||||
.min(2, { message: 'Username must be at least 2 characters' })
|
.min(2, { message: "Username must be at least 2 characters" })
|
||||||
.max(24, { message: 'Username must be 24 characters or less' })
|
.max(24, { message: "Username must be 24 characters or less" })
|
||||||
.regex(/^[a-zA-Z0-9]*$/, { message: 'Username can only contain letters or numbers.' })
|
.regex(/^[a-zA-Z0-9]*$/, {
|
||||||
|
message: "Username can only contain letters or numbers.",
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updatePasswordSchema = z
|
export const updatePasswordSchema = z
|
||||||
.object({
|
.object({
|
||||||
oldPassword: z.string({ required_error: 'Old password is required' }),
|
oldPassword: z.string({ required_error: "Old password is required" }),
|
||||||
password: z
|
password: z
|
||||||
.string({ required_error: 'Password is required' })
|
.string({ required_error: "Password is required" })
|
||||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
.regex(
|
||||||
|
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||||
|
{
|
||||||
message:
|
message:
|
||||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
passwordConfirm: z
|
passwordConfirm: z
|
||||||
.string({ required_error: 'Confirm Password is required' })
|
.string({ required_error: "Confirm Password is required" })
|
||||||
.regex(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/, {
|
.regex(
|
||||||
|
/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&+\-,.\[\]{};':"\\|/=\(\)\^_*]{8,}$/,
|
||||||
|
{
|
||||||
message:
|
message:
|
||||||
'Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.'
|
"Password must be a minimum of 8 characters & contain at least one letter, one number, and one special character.",
|
||||||
})
|
},
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.superRefine(({ passwordConfirm, password }, ctx) => {
|
.superRefine(({ passwordConfirm, password }, ctx) => {
|
||||||
if (passwordConfirm !== password) {
|
if (passwordConfirm !== password) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Password & Confirm password must match',
|
message: "Password & Confirm password must match",
|
||||||
path: ['password']
|
path: ["password"],
|
||||||
});
|
});
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Password & Confirm password must match',
|
message: "Password & Confirm password must match",
|
||||||
path: ['passwordConfirm']
|
path: ["passwordConfirm"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateProfileSchema = z.object({
|
export const updateProfileSchema = z.object({
|
||||||
name: z
|
name: z
|
||||||
.string({ required_error: 'Name is required' })
|
.string({ required_error: "Name is required" })
|
||||||
.min(1, { message: 'Name is required' })
|
.min(1, { message: "Name is required" })
|
||||||
.max(64, { message: 'Name must be 64 characters or less' })
|
.max(64, { message: "Name must be 64 characters or less" })
|
||||||
.trim(),
|
.trim(),
|
||||||
avatar: z
|
avatar: z
|
||||||
.instanceof(Blob)
|
.instanceof(Blob)
|
||||||
@ -229,31 +244,28 @@ export const updateProfileSchema = z.object({
|
|||||||
if (val.size > 5242880) {
|
if (val.size > 5242880) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Avatar must be less than 5MB'
|
message: "Avatar must be less than 5MB",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!imageTypes.includes(val.type)) {
|
if (!imageTypes.includes(val.type)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif'
|
message:
|
||||||
|
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const updateAvatarSchema = z.object({
|
export const updateAvatarSchema = z.object({
|
||||||
avatar: z
|
avatar: z.instanceof(File).superRefine((val, ctx) => {
|
||||||
.instanceof(File)
|
|
||||||
.superRefine((val, ctx) => {
|
|
||||||
if (val) {
|
if (val) {
|
||||||
if (val.size > 5242880) {
|
if (val.size > 5242880) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Avatar must be less than 5MB',
|
message: "Avatar must be less than 5MB",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,148 +277,118 @@ export const updateAvatarSchema = z.object({
|
|||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message:
|
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 createCommentTextSchema = z.object({
|
export const createCommentTextSchema = z.object({
|
||||||
comment: z
|
comment: z
|
||||||
.string({ required_error: 'Comment cannot be empty' })
|
.string({ required_error: "Comment cannot be empty" })
|
||||||
.min(1, { message: 'Comment cannot be empty' })
|
.min(1, { message: "Comment cannot be empty" })
|
||||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||||
.trim(),
|
.trim(),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
post: z.string({ required_error: 'Post is required.' }),
|
post: z.string({ required_error: "Post is required." }),
|
||||||
reply: z.string(),
|
reply: z.string(),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateCommentTextSchema = z.object({
|
export const updateCommentTextSchema = z.object({
|
||||||
comment: z
|
comment: z
|
||||||
.string({ required_error: 'Comment cannot be empty' })
|
.string({ required_error: "Comment cannot be empty" })
|
||||||
.min(1, { message: 'Comment cannot be empty' })
|
.min(1, { message: "Comment cannot be empty" })
|
||||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||||
.trim(),
|
.trim(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const createCommentImageSchema = z.object({
|
export const createCommentImageSchema = z.object({
|
||||||
comment: z
|
comment: z
|
||||||
.string({ required_error: 'Comment cannot be empty' })
|
.string({ required_error: "Comment cannot be empty" })
|
||||||
.min(1, { message: 'Comment cannot be empty' })
|
.min(1, { message: "Comment cannot be empty" })
|
||||||
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
//.max(40000, { message: 'Comment is too long. Keep it simple and concise bruv!' })
|
||||||
.trim(),
|
.trim(),
|
||||||
image: z
|
image: z
|
||||||
.instanceof(Blob, { message: 'Image is required' })
|
.instanceof(Blob, { message: "Image is required" })
|
||||||
.superRefine((val, ctx) => {
|
.superRefine((val, ctx) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
if (val.size > 5242880) {
|
if (val.size > 5242880) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Image must be less than 5MB'
|
message: "Image must be less than 5MB",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!imageTypes.includes(val.type)) {
|
if (!imageTypes.includes(val.type)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: 'Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif'
|
message:
|
||||||
|
"Unsupported file type. Supported formats: jpeg, jpg, png, webp, svg, gif",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
post: z.string({ required_error: 'Post is required.' }),
|
post: z.string({ required_error: "Post is required." }),
|
||||||
reply: z.string(),
|
reply: z.string(),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const createNotebookSchema = z.object({
|
export const createNotebookSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title cannot be empty' })
|
.string({ required_error: "Title cannot be empty" })
|
||||||
.min(1, { message: 'Title cannot be empty' })
|
.min(1, { message: "Title cannot be empty" })
|
||||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
.max(100, {
|
||||||
|
message: "Title is too long. Keep it simple and concise bruv!",
|
||||||
|
})
|
||||||
.trim(),
|
.trim(),
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
user: z.string({ required_error: "User is required." }),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const createStrategySchema = z.object({
|
export const createStrategySchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title cannot be empty' })
|
.string({ required_error: "Title cannot be empty" })
|
||||||
.min(1, { message: 'Title cannot be empty' })
|
.min(1, { message: "Title cannot be empty" })
|
||||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
.max(100, {
|
||||||
|
message: "Title is too long. Keep it simple and concise bruv!",
|
||||||
|
})
|
||||||
.trim(),
|
.trim(),
|
||||||
rules: z
|
rules: z.string().trim(),
|
||||||
.string()
|
results: z.string().trim(),
|
||||||
.trim(),
|
liveResults: z.string().trim(),
|
||||||
results: z
|
user: z.string({ required_error: "User is required." }),
|
||||||
.string()
|
|
||||||
.trim(),
|
|
||||||
liveResults: z
|
|
||||||
.string()
|
|
||||||
.trim(),
|
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const createPortfolioSchema = z.object({
|
export const createPortfolioSchema = z.object({
|
||||||
accountValue: z
|
accountValue: z.string().trim(),
|
||||||
.string()
|
availableCash: z.string().trim(),
|
||||||
.trim(),
|
overallReturn: z.string().trim(),
|
||||||
availableCash: z
|
rank: z.string().trim(),
|
||||||
.string()
|
holdings: z.string().trim(),
|
||||||
.trim(),
|
tradingHistory: z.string().trim(),
|
||||||
overallReturn: z
|
metrics: z.string().trim(),
|
||||||
.string()
|
user: z.string({ required_error: "User is required." }),
|
||||||
.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({
|
export const createWatchListSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title cannot be empty' })
|
.string({ required_error: "Title cannot be empty" })
|
||||||
.min(1, { message: 'Title cannot be empty' })
|
.min(1, { message: "Title cannot be empty" })
|
||||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
.max(100, {
|
||||||
|
message: "Title is too long. Keep it simple and concise bruv!",
|
||||||
|
})
|
||||||
.trim(),
|
.trim(),
|
||||||
ticker: z
|
ticker: z.string().trim(),
|
||||||
.string()
|
user: z.string({ required_error: "User is required." }),
|
||||||
.trim(),
|
|
||||||
user: z.string({ required_error: 'User is required.' }),
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const editWatchListSchema = z.object({
|
export const editWatchListSchema = z.object({
|
||||||
title: z
|
title: z
|
||||||
.string({ required_error: 'Title cannot be empty' })
|
.string({ required_error: "Title cannot be empty" })
|
||||||
.min(1, { message: 'Title cannot be empty' })
|
.min(1, { message: "Title cannot be empty" })
|
||||||
.max(100, { message: 'Title is too long. Keep it simple and concise bruv!' })
|
.max(100, {
|
||||||
|
message: "Title is too long. Keep it simple and concise bruv!",
|
||||||
|
})
|
||||||
.trim(),
|
.trim(),
|
||||||
watchListId: z.string({ required_error: 'Id is required.' }),
|
watchListId: z.string({ required_error: "Id is required." }),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,24 +4,26 @@ function generateDateList(val) {
|
|||||||
var dateList = [];
|
var dateList = [];
|
||||||
dateList.push(formatDate(currentDate)); // Add current date to the list
|
dateList.push(formatDate(currentDate)); // Add current date to the list
|
||||||
|
|
||||||
for (var i = 1; i <= val; i++) { // Generate 10 more dates, 30 days apart
|
for (var i = 1; i <= val; i++) {
|
||||||
var previousDate = new Date(currentDate.getTime() - (i * 1 * 24 * 60 * 60 * 1000)); // Calculate the previous date
|
// 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
|
dateList.unshift(formatDate(previousDate)); // Add the previous date to the beginning of the list
|
||||||
}
|
}
|
||||||
|
|
||||||
return dateList;
|
return dateList;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(date) {
|
function formatDate(date) {
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
var month = ('0' + (date.getMonth() + 1)).slice(-2); // Month is zero-based, so we add 1
|
var month = ("0" + (date.getMonth() + 1)).slice(-2); // Month is zero-based, so we add 1
|
||||||
var day = ('0' + date.getDate()).slice(-2);
|
var day = ("0" + date.getDate()).slice(-2);
|
||||||
|
|
||||||
return year + '-' + month + '-' + day;
|
return year + "-" + month + "-" + day;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dateList = generateDateList(30);
|
|
||||||
|
|
||||||
|
var dateList = generateDateList(30);
|
||||||
|
|
||||||
function generateRandomNumberList() {
|
function generateRandomNumberList() {
|
||||||
var numberList = [];
|
var numberList = [];
|
||||||
@ -32,63 +34,61 @@ function generateRandomNumberList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return numberList;
|
return numberList;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTrigonometricNumberList(val) {
|
function generateTrigonometricNumberList(val) {
|
||||||
var numberList = [];
|
var numberList = [];
|
||||||
|
|
||||||
for (var i = 0; i < 100; i++) {
|
for (var i = 0; i < 100; i++) {
|
||||||
var angle = (i / 100) * Math.PI * 2 ; // Calculate the angle based on the index
|
var angle = (i / 100) * Math.PI * 2; // Calculate the angle based on the index
|
||||||
var value = Math.sin(angle) * val; // Calculate the sine value
|
var value = Math.sin(angle) * val; // Calculate the sine value
|
||||||
numberList.push(value); // Add the value to the list
|
numberList.push(value); // Add the value to the list
|
||||||
}
|
}
|
||||||
|
|
||||||
return numberList;
|
return numberList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var rsiList = generateRandomNumberList();
|
var rsiList = generateRandomNumberList();
|
||||||
export const rsiGraph = {
|
export const rsiGraph = {
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: "category",
|
||||||
data: dateList
|
data: dateList,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: "value",
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
data: rsiList,
|
data: rsiList,
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#FFF' // Red color for the line
|
color: "#FFF", // Red color for the line
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
data: Array(30).fill(30),
|
data: Array(30).fill(30),
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#0BA111', // Red color for the line
|
color: "#0BA111", // Red color for the line
|
||||||
width: 4,
|
width: 4,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
data: Array(30).fill(70),
|
data: Array(30).fill(70),
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#FF0000', // Red color for the line
|
color: "#FF0000", // Red color for the line
|
||||||
width: 4,
|
width: 4,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//MACD Indicator
|
//MACD Indicator
|
||||||
var macdList = generateTrigonometricNumberList(1);
|
var macdList = generateTrigonometricNumberList(1);
|
||||||
@ -97,69 +97,65 @@ var macdLineList = generateTrigonometricNumberList(1.5);
|
|||||||
var macdDateList = generateDateList(100);
|
var macdDateList = generateDateList(100);
|
||||||
export const macdGraph = {
|
export const macdGraph = {
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: "category",
|
||||||
data: macdDateList
|
data: macdDateList,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: "value",
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
data: macdList,
|
data: macdList,
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#0BA111' // Red color for the line
|
color: "#0BA111", // Red color for the line
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: macdLineList,
|
data: macdLineList,
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#FF0000' // Red color for the line
|
color: "#FF0000", // Red color for the line
|
||||||
}
|
|
||||||
},
|
},
|
||||||
]
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//MACD Indicator
|
//MACD Indicator
|
||||||
var sma50List = generateTrigonometricNumberList(100);
|
var sma50List = generateTrigonometricNumberList(100);
|
||||||
var sma200List = generateTrigonometricNumberList(120);
|
var sma200List = generateTrigonometricNumberList(120);
|
||||||
|
|
||||||
|
|
||||||
var smaDateList = generateDateList(100);
|
var smaDateList = generateDateList(100);
|
||||||
export const smaGraph = {
|
export const smaGraph = {
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: "category",
|
||||||
data: smaDateList
|
data: smaDateList,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: "value",
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
data: sma50List,
|
data: sma50List,
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#0BA111' // Red color for the line
|
color: "#0BA111", // Red color for the line
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: sma200List,
|
data: sma200List,
|
||||||
type: 'line',
|
type: "line",
|
||||||
symbol: 'none', // Remove the dots
|
symbol: "none", // Remove the dots
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid', // Make the line solid
|
type: "solid", // Make the line solid
|
||||||
color: '#FF0000' // Red color for the line
|
color: "#FF0000", // Red color for the line
|
||||||
}
|
|
||||||
},
|
},
|
||||||
]
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -20,7 +20,7 @@ type FlyAndScaleParams = {
|
|||||||
|
|
||||||
export const flyAndScale = (
|
export const flyAndScale = (
|
||||||
node: Element,
|
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 => {
|
): TransitionConfig => {
|
||||||
const style = getComputedStyle(node);
|
const style = getComputedStyle(node);
|
||||||
const transform = style.transform === "none" ? "" : style.transform;
|
const transform = style.transform === "none" ? "" : style.transform;
|
||||||
@ -28,7 +28,7 @@ export const flyAndScale = (
|
|||||||
const scaleConversion = (
|
const scaleConversion = (
|
||||||
valueA: number,
|
valueA: number,
|
||||||
scaleA: [number, number],
|
scaleA: [number, number],
|
||||||
scaleB: [number, number]
|
scaleB: [number, number],
|
||||||
) => {
|
) => {
|
||||||
const [minA, maxA] = scaleA;
|
const [minA, maxA] = scaleA;
|
||||||
const [minB, maxB] = scaleB;
|
const [minB, maxB] = scaleB;
|
||||||
@ -40,7 +40,7 @@ export const flyAndScale = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const styleToString = (
|
const styleToString = (
|
||||||
style: Record<string, number | string | undefined>
|
style: Record<string, number | string | undefined>,
|
||||||
): string => {
|
): string => {
|
||||||
return Object.keys(style).reduce((str, key) => {
|
return Object.keys(style).reduce((str, key) => {
|
||||||
if (style[key] === undefined) return str;
|
if (style[key] === undefined) return str;
|
||||||
@ -212,7 +212,7 @@ export function sumQuarterlyResultsByYear(quarterlyResults, namingList) {
|
|||||||
|
|
||||||
// Filter out years with less than 4 quarters
|
// Filter out years with less than 4 quarters
|
||||||
const validYears = Object?.keys(quarterCounts)?.filter(
|
const validYears = Object?.keys(quarterCounts)?.filter(
|
||||||
(year) => quarterCounts[year] === 4
|
(year) => quarterCounts[year] === 4,
|
||||||
);
|
);
|
||||||
const annualResults = validYears?.map((year) => yearlySummaries[year]);
|
const annualResults = validYears?.map((year) => yearlySummaries[year]);
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ export function formatETFName(inputString) {
|
|||||||
|
|
||||||
// Capitalize the first letter of each word
|
// Capitalize the first letter of each word
|
||||||
const capitalizedWords = words?.map(
|
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
|
// Join the words back together with a space between them
|
||||||
@ -442,7 +442,7 @@ export function addDays(data, days, state) {
|
|||||||
} else {
|
} else {
|
||||||
const differenceInTime = result - createdDate;
|
const differenceInTime = result - createdDate;
|
||||||
const differenceInDays = Math.round(
|
const differenceInDays = Math.round(
|
||||||
differenceInTime / (1000 * 60 * 60 * 24)
|
differenceInTime / (1000 * 60 * 60 * 24),
|
||||||
);
|
);
|
||||||
return Math.abs(differenceInDays);
|
return Math.abs(differenceInDays);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +1,43 @@
|
|||||||
// lib/workers/test.ts
|
// 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",
|
||||||
const response = await fetch(fastifyURL+'/get-notifications', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData)
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
|
|
||||||
const output = (await response.json())?.items;
|
const output = (await response.json())?.items;
|
||||||
return output
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
onmessage = async (event: MessageEvent) => {
|
onmessage = async (event: MessageEvent) => {
|
||||||
const data = event.data?.message;
|
const data = event.data?.message;
|
||||||
const fastifyURL = data?.fastifyURL;
|
const fastifyURL = data?.fastifyURL;
|
||||||
const userId = data?.userId;
|
const userId = data?.userId;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const [notificationList] = await Promise.all([
|
const [notificationList] = await Promise.all([
|
||||||
loadNotifications(fastifyURL, userId),
|
loadNotifications(fastifyURL, userId),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const numberOfUnreadNotification = notificationList?.length
|
const numberOfUnreadNotification = notificationList?.length;
|
||||||
const hasUnreadElement = notificationList?.length !== 0 ? true : false;
|
const hasUnreadElement = notificationList?.length !== 0 ? true : false;
|
||||||
const output = {notificationList, hasUnreadElement, numberOfUnreadNotification}
|
const output = {
|
||||||
|
notificationList,
|
||||||
|
hasUnreadElement,
|
||||||
|
numberOfUnreadNotification,
|
||||||
|
};
|
||||||
|
|
||||||
postMessage({ message: 'success', output});
|
postMessage({ message: "success", output });
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
postMessage({ message: 'error', e});
|
postMessage({ message: "error", e });
|
||||||
}
|
}
|
||||||
// Sending data back to the main thread
|
// Sending data back to the main thread
|
||||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||||
};
|
};
|
||||||
|
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
@ -1,32 +1,30 @@
|
|||||||
async function loadTwitchStatus(fastifyURL:string,) {
|
async function loadTwitchStatus(fastifyURL: string) {
|
||||||
// make the GET request to the endpoint
|
// make the GET request to the endpoint
|
||||||
const response = await fetch(fastifyURL+'/get-twitch-status', {
|
const response = await fetch(fastifyURL + "/get-twitch-status", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json","X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const output = (await response.json())?.items;
|
const output = (await response.json())?.items;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onmessage = async (event: MessageEvent) => {
|
||||||
|
|
||||||
onmessage = async (event: MessageEvent) => {
|
|
||||||
const data = event.data?.message;
|
const data = event.data?.message;
|
||||||
const fastifyURL = data?.fastifyURL;
|
const fastifyURL = data?.fastifyURL;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const twitchStatus = await loadTwitchStatus(fastifyURL);
|
const twitchStatus = await loadTwitchStatus(fastifyURL);
|
||||||
const output = {twitchStatus};
|
const output = { twitchStatus };
|
||||||
|
|
||||||
postMessage({ message: 'success', output});
|
postMessage({ message: "success", output });
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
postMessage({ message: 'error', e});
|
postMessage({ message: "error", e });
|
||||||
}
|
}
|
||||||
// Sending data back to the main thread
|
// Sending data back to the main thread
|
||||||
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
//postMessage({ message: 'Data received in the worker', ticker, apiURL });
|
||||||
};
|
};
|
||||||
|
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
@ -4,10 +4,10 @@ export const load = ({ locals, cookies }) => {
|
|||||||
return {
|
return {
|
||||||
user: user || undefined,
|
user: user || undefined,
|
||||||
region,
|
region,
|
||||||
cookieConsent: cookies?.get('cookie-consent'),
|
cookieConsent: cookies?.get("cookie-consent"),
|
||||||
apiURL,
|
apiURL,
|
||||||
fastifyURL,
|
fastifyURL,
|
||||||
wsURL,
|
wsURL,
|
||||||
apiKey,
|
apiKey,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export const actions = {
|
|||||||
login: async ({ request, locals }) => {
|
login: async ({ request, locals }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
loginUserSchema
|
loginUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -52,7 +52,7 @@ export const actions = {
|
|||||||
register: async ({ locals, request }) => {
|
register: async ({ locals, request }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
registerUserSchema
|
registerUserSchema,
|
||||||
);
|
);
|
||||||
if (errors) {
|
if (errors) {
|
||||||
return fail(400, {
|
return fail(400, {
|
||||||
@ -122,7 +122,7 @@ export const actions = {
|
|||||||
const redirectURL = `${url.origin}/oauth`;
|
const redirectURL = `${url.origin}/oauth`;
|
||||||
|
|
||||||
const targetItem = authMethods.authProviders?.findIndex(
|
const targetItem = authMethods.authProviders?.findIndex(
|
||||||
(item) => item?.name === providerSelected
|
(item) => item?.name === providerSelected,
|
||||||
);
|
);
|
||||||
//console.log("==================")
|
//console.log("==================")
|
||||||
//console.log(authMethods.authProviders)
|
//console.log(authMethods.authProviders)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export const load = async ({ parent }) => {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
output = (await response.json())["stargazers_count"];
|
output = (await response.json())["stargazers_count"];
|
||||||
@ -43,7 +43,7 @@ export const load = async ({ parent }) => {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
output = (await response.json())["stargazers_count"];
|
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 () => {
|
const getAnalystStats = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache(params.slug, 'getAnalystStats');
|
const cachedData = getCache(params.slug, "getAnalystStats");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} 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
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/analyst-stats', {
|
const response = await fetch(apiURL + "/analyst-stats", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getAnalystStats'
|
// Cache the data for this specific tickerID with a specific name 'getAnalystStats'
|
||||||
setCache(params.slug, output, 'getAnalystStats');
|
setCache(params.slug, output, "getAnalystStats");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -34,6 +33,6 @@ export const load = async ({parent, params}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getAnalystStats: await getAnalystStats()
|
getAnalystStats: await getAnalystStats(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,69 +1,66 @@
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from "./$types";
|
||||||
|
|
||||||
function secondsUntilEndOfDay() {
|
function secondsUntilEndOfDay() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
const endOfDay = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth(),
|
||||||
|
now.getDate() + 1,
|
||||||
|
);
|
||||||
const secondsUntilEndOfDay = (endOfDay - now) / 1000;
|
const secondsUntilEndOfDay = (endOfDay - now) / 1000;
|
||||||
return secondsUntilEndOfDay;
|
return secondsUntilEndOfDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const POST = (async ({ request, cookies, locals }) => {
|
||||||
|
let output = "error";
|
||||||
export const POST = (async ( {request, cookies, locals} ) => {
|
const data = await request.json();
|
||||||
|
|
||||||
let output = 'error';
|
|
||||||
const data = await request.json()
|
|
||||||
const sentiment = data?.sentiment;
|
const sentiment = data?.sentiment;
|
||||||
const ticker = data?.ticker
|
const ticker = data?.ticker;
|
||||||
const sentimentId = data?.sentimentId;
|
const sentimentId = data?.sentimentId;
|
||||||
const maxAge = secondsUntilEndOfDay();
|
const maxAge = secondsUntilEndOfDay();
|
||||||
|
|
||||||
let newData;
|
let newData;
|
||||||
|
|
||||||
if (cookies?.get('community-sentiment-'+ticker)) {
|
if (cookies?.get("community-sentiment-" + ticker)) {
|
||||||
//console.log('already voted')
|
//console.log('already voted')
|
||||||
return new Response(JSON.stringify(output))
|
return new Response(JSON.stringify(output));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
if (sentimentId) {
|
if (sentimentId) {
|
||||||
if (sentiment === 'upvote') {
|
if (sentiment === "upvote") {
|
||||||
await locals?.pb?.collection('sentiment').update( sentimentId, {'upvote+': 1})
|
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 === 'downvote') {
|
} else {
|
||||||
await locals?.pb?.collection('sentiment').update( sentimentId, {'downvote+': 1})
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
output = "success";
|
||||||
|
|
||||||
if (sentiment === 'upvote') {
|
cookies.set("community-sentiment-" + ticker, sentiment, {
|
||||||
newData = await locals?.pb?.collection('sentiment').create({'ticker': ticker, 'upvote': 1})
|
httpOnly: true,
|
||||||
}
|
sameSite: "lax",
|
||||||
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,
|
secure: true,
|
||||||
path: '/',
|
path: "/",
|
||||||
maxAge: maxAge // End of day expiry
|
maxAge: maxAge, // End of day expiry
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
} catch(e) {
|
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Response(JSON.stringify(output));
|
||||||
|
|
||||||
return new Response(JSON.stringify(output))
|
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +1,22 @@
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from "./$types";
|
||||||
|
|
||||||
|
export const POST = (async ({ request, cookies }) => {
|
||||||
export const POST = (async ( {request, cookies} ) => {
|
let output = "error";
|
||||||
|
const data = await request.json();
|
||||||
let output = 'error';
|
|
||||||
const data = await request.json()
|
|
||||||
const consent = data?.consent;
|
const consent = data?.consent;
|
||||||
try {
|
try {
|
||||||
|
cookies.set("cookie-consent", consent, {
|
||||||
cookies.set('cookie-consent', consent, {httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: "lax",
|
||||||
secure: true,
|
secure: true,
|
||||||
path: '/',
|
path: "/",
|
||||||
maxAge: 60*60*24*365 // 1 Year consent
|
maxAge: 60 * 60 * 24 * 365, // 1 Year consent
|
||||||
});
|
});
|
||||||
|
|
||||||
output = 'success';
|
output = "success";
|
||||||
|
} catch (e) {
|
||||||
} catch(e) {
|
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Response(JSON.stringify(output));
|
||||||
return new Response(JSON.stringify(output))
|
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from "./$types";
|
||||||
import { serialize } from 'object-to-formdata';
|
import { serialize } from "object-to-formdata";
|
||||||
import { validateData } from '$lib/utils';
|
import { validateData } from "$lib/utils";
|
||||||
import { createCommentTextSchema, createCommentImageSchema } from '$lib/schemas';
|
import {
|
||||||
import { error} from '@sveltejs/kit';
|
createCommentTextSchema,
|
||||||
|
createCommentImageSchema,
|
||||||
|
} from "$lib/schemas";
|
||||||
|
import { error } from "@sveltejs/kit";
|
||||||
//import sharp from 'sharp';
|
//import sharp from 'sharp';
|
||||||
//import { marked } from 'marked';
|
//import { marked } from 'marked';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
export const config = {
|
export const config = {
|
||||||
runtime: 'nodejs20.x',
|
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");
|
||||||
if (body?.get('comment') === 'undefined')
|
body?.append("comment", "");
|
||||||
{
|
|
||||||
body?.delete('comment');
|
|
||||||
body?.append('comment', '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body?.get('reply') === null)
|
if (body?.get("reply") === null) {
|
||||||
{
|
body?.delete("reply");
|
||||||
body?.delete('reply');
|
body?.append("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) {
|
if (errors) {
|
||||||
return new Response(JSON.stringify(output));
|
return new Response(JSON.stringify(output));
|
||||||
}
|
}
|
||||||
//formData.comment = addClassesToHtml(marked(formData?.comment))
|
//formData.comment = addClassesToHtml(marked(formData?.comment))
|
||||||
|
|
||||||
|
/*
|
||||||
/*
|
|
||||||
if (formData?.image?.type?.includes('image'))
|
if (formData?.image?.type?.includes('image'))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -140,59 +141,49 @@ const body = await request.formData();
|
|||||||
|
|
||||||
await locals.pb.collection("users").update(locals?.user?.id, {
|
await locals.pb.collection("users").update(locals?.user?.id, {
|
||||||
"karma+": 1,
|
"karma+": 1,
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
let newComment;
|
let newComment;
|
||||||
try {
|
try {
|
||||||
|
newComment = await locals.pb
|
||||||
newComment = await locals.pb.collection('comments').create(serialize(formData), {
|
.collection("comments")
|
||||||
expand: 'user,alreadyVoted(comment)',
|
.create(serialize(formData), {
|
||||||
fields: "*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
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
|
//create new record for notifications collections
|
||||||
if (locals?.user?.id !== opPost?.user)
|
if (locals?.user?.id !== opPost?.user) {
|
||||||
{
|
|
||||||
let formDataNotifications = new FormData();
|
let formDataNotifications = new FormData();
|
||||||
formDataNotifications.append('opUser', opPost?.user);
|
formDataNotifications.append("opUser", opPost?.user);
|
||||||
formDataNotifications.append('user', formData?.user)
|
formDataNotifications.append("user", formData?.user);
|
||||||
formDataNotifications.append('post', postId);
|
formDataNotifications.append("post", postId);
|
||||||
formDataNotifications.append('comment', newComment?.id)
|
formDataNotifications.append("comment", newComment?.id);
|
||||||
formDataNotifications.append('notifyType', 'comment');
|
formDataNotifications.append("notifyType", "comment");
|
||||||
|
|
||||||
await locals.pb.collection('notifications').create(formDataNotifications);
|
|
||||||
|
|
||||||
|
await locals.pb.collection("notifications").create(formDataNotifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let formDataAlreadyVoted = new FormData();
|
let formDataAlreadyVoted = new FormData();
|
||||||
formDataAlreadyVoted.append('comment', newComment?.id);
|
formDataAlreadyVoted.append("comment", newComment?.id);
|
||||||
formDataAlreadyVoted.append('user', newComment?.user);
|
formDataAlreadyVoted.append("user", newComment?.user);
|
||||||
formDataAlreadyVoted.append('type', 'upvote');
|
formDataAlreadyVoted.append("type", "upvote");
|
||||||
//console.log(formDataAlreadyVoted)
|
//console.log(formDataAlreadyVoted)
|
||||||
await locals.pb.collection('alreadyVoted').create(formDataAlreadyVoted);
|
await locals.pb.collection("alreadyVoted").create(formDataAlreadyVoted);
|
||||||
|
|
||||||
//User always upvotes their comment in the intial state
|
//User always upvotes their comment in the intial state
|
||||||
await locals.pb.collection("comments").update(newComment?.id, {
|
await locals.pb.collection("comments").update(newComment?.id, {
|
||||||
"upvote+": 1,
|
"upvote+": 1,
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
output = 'success';
|
|
||||||
|
|
||||||
|
|
||||||
|
output = "success";
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error: ', err);
|
console.log("Error: ", err);
|
||||||
error(err.status, err.message);
|
error(err.status, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new Response(JSON.stringify([output, newComment]));
|
return new Response(JSON.stringify([output, newComment]));
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
@ -1,50 +1,47 @@
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from "./$types";
|
||||||
import { serialize } from 'object-to-formdata';
|
import { serialize } from "object-to-formdata";
|
||||||
import { validateData } from '$lib/utils';
|
import { validateData } from "$lib/utils";
|
||||||
import { updateCommentTextSchema} from '$lib/schemas';
|
import { updateCommentTextSchema } from "$lib/schemas";
|
||||||
import { error} from '@sveltejs/kit';
|
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';
|
if (body?.get("comment") === "undefined") {
|
||||||
|
body?.delete("comment");
|
||||||
const body = await request.formData();
|
body?.append("comment", "");
|
||||||
const commentId = body?.get('commentId');
|
|
||||||
|
|
||||||
if (body?.get('comment') === 'undefined')
|
|
||||||
{
|
|
||||||
body?.delete('comment');
|
|
||||||
body?.append('comment', '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {formData, errors} = await validateData( body, updateCommentTextSchema);
|
const { formData, errors } = await validateData(
|
||||||
console.log(error)
|
body,
|
||||||
|
updateCommentTextSchema,
|
||||||
|
);
|
||||||
|
console.log(error);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
|
|
||||||
return new Response(JSON.stringify(output));
|
return new Response(JSON.stringify(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let updateComment;
|
let updateComment;
|
||||||
try {
|
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)",
|
||||||
updateComment = await locals.pb.collection('comments').getOne(commentId, {
|
fields:
|
||||||
expand: 'user,alreadyVoted(comment)',
|
"*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
||||||
fields: "*,expand.user,expand.alreadyVoted(comment).user,expand.alreadyVoted(comment).type",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
output = 'success';
|
output = "success";
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error: ', err);
|
console.log("Error: ", err);
|
||||||
error(err.status, err.message);
|
error(err.status, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new Response(JSON.stringify([output, updateComment]));
|
return new Response(JSON.stringify([output, updateComment]));
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
@ -1,29 +1,35 @@
|
|||||||
import { promises as fsPromises } from 'fs';
|
import { promises as fsPromises } from "fs";
|
||||||
import fs from 'fs';
|
import fs from "fs";
|
||||||
import fetch from 'node-fetch';
|
import fetch from "node-fetch";
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from "@sveltejs/kit";
|
||||||
|
|
||||||
const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB in bytes
|
const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB in bytes
|
||||||
|
|
||||||
const parseRange = (range: string) => {
|
const parseRange = (range: string) => {
|
||||||
const [start, end] = range.replace(/bytes=/, '').split('-').map(Number);
|
const [start, end] = range
|
||||||
|
.replace(/bytes=/, "")
|
||||||
|
.split("-")
|
||||||
|
.map(Number);
|
||||||
return { start, end: end || undefined };
|
return { start, end: end || undefined };
|
||||||
};
|
};
|
||||||
|
|
||||||
const createResponse = (body: ReadableStream | Buffer, headers: Record<string, string>, status = 206) =>
|
const createResponse = (
|
||||||
new Response(body, { status, headers });
|
body: ReadableStream | Buffer,
|
||||||
|
headers: Record<string, string>,
|
||||||
|
status = 206,
|
||||||
|
) => new Response(body, { status, headers });
|
||||||
|
|
||||||
const streamRemoteFile = async (url: string, range: string) => {
|
const streamRemoteFile = async (url: string, range: string) => {
|
||||||
const { start, end } = parseRange(range);
|
const { start, end } = parseRange(range);
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: { Range: `bytes=${start}-${end || ''}` }
|
headers: { Range: `bytes=${start}-${end || ""}` },
|
||||||
});
|
});
|
||||||
|
|
||||||
return createResponse(response.body, {
|
return createResponse(response.body, {
|
||||||
'Content-Range': response.headers.get('Content-Range') || '',
|
"Content-Range": response.headers.get("Content-Range") || "",
|
||||||
'Accept-Ranges': 'bytes',
|
"Accept-Ranges": "bytes",
|
||||||
'Content-Length': response.headers.get('Content-Length') || '',
|
"Content-Length": response.headers.get("Content-Length") || "",
|
||||||
'Content-Type': response.headers.get('Content-Type') || '',
|
"Content-Type": response.headers.get("Content-Type") || "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,37 +39,44 @@ const streamLocalFile = async (filePath: string, range: string) => {
|
|||||||
const chunkEnd = end || Math.min(start + CHUNK_SIZE - 1, fileSize - 1);
|
const chunkEnd = end || Math.min(start + CHUNK_SIZE - 1, fileSize - 1);
|
||||||
|
|
||||||
if (start >= fileSize) {
|
if (start >= fileSize) {
|
||||||
return new Response(`Requested range not satisfiable\n${start} >= ${fileSize}`, {
|
return new Response(
|
||||||
|
`Requested range not satisfiable\n${start} >= ${fileSize}`,
|
||||||
|
{
|
||||||
status: 416,
|
status: 416,
|
||||||
headers: { 'Content-Range': `bytes */${fileSize}` },
|
headers: { "Content-Range": `bytes */${fileSize}` },
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const stream = fs.createReadStream(filePath, { start, end: chunkEnd });
|
const stream = fs.createReadStream(filePath, { start, end: chunkEnd });
|
||||||
|
|
||||||
return createResponse(stream, {
|
return createResponse(stream, {
|
||||||
'Content-Range': `bytes ${start}-${chunkEnd}/${fileSize}`,
|
"Content-Range": `bytes ${start}-${chunkEnd}/${fileSize}`,
|
||||||
'Accept-Ranges': 'bytes',
|
"Accept-Ranges": "bytes",
|
||||||
'Content-Length': (chunkEnd - start + 1).toString(),
|
"Content-Length": (chunkEnd - start + 1).toString(),
|
||||||
'Content-Type': 'video/mp4',
|
"Content-Type": "video/mp4",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params, request }) => {
|
export const GET: RequestHandler = async ({ params, request }) => {
|
||||||
const { filename } = params;
|
const { filename } = params;
|
||||||
const range = request.headers.get('range');
|
const range = request.headers.get("range");
|
||||||
|
|
||||||
if (!range) {
|
if (!range) {
|
||||||
return new Response('Requires Range header', { status: 400 });
|
return new Response("Requires Range header", { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const videoPath = filename.startsWith('http') ? filename : `static/${filename}`;
|
const videoPath = filename.startsWith("http")
|
||||||
return filename.startsWith('http') ?
|
? filename
|
||||||
await streamRemoteFile(videoPath, range) :
|
: `static/${filename}`;
|
||||||
await streamLocalFile(videoPath, range);
|
return filename.startsWith("http")
|
||||||
|
? await streamRemoteFile(videoPath, range)
|
||||||
|
: await streamLocalFile(videoPath, range);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error streaming video:', error);
|
console.error("Error streaming video:", error);
|
||||||
return new Response('File not found or error streaming video', { status: 404 });
|
return new Response("File not found or error streaming video", {
|
||||||
|
status: 404,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1,25 +1,23 @@
|
|||||||
import { pb } from "$lib/pocketbase";
|
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 () => {
|
const getAllBlogPost = async () => {
|
||||||
let output;
|
let output;
|
||||||
console.log(await parent())
|
console.log(await parent());
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache('allBlogPost', 'getAllBlogPost');
|
const cachedData = getCache("allBlogPost", "getAllBlogPost");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
output = await pb.collection('articles').getFullList({
|
output = await pb.collection("articles").getFullList({
|
||||||
expand: 'user',
|
expand: "user",
|
||||||
sort: '-created'
|
sort: "-created",
|
||||||
})
|
});
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getAllBlogPost'
|
// Cache the data for this specific tickerID with a specific name 'getAllBlogPost'
|
||||||
setCache('allBlogPost', output, 'getAllBlogPost');
|
setCache("allBlogPost", output, "getAllBlogPost");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -27,6 +25,6 @@ export const load = async ({parent}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getAllBlogPost: await getAllBlogPost()
|
getAllBlogPost: await getAllBlogPost(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,22 +1,22 @@
|
|||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from "$lib/store";
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params }) => {
|
export const load = async ({ params }) => {
|
||||||
const getArticle = async () => {
|
const getArticle = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache(params?.slug, 'getArticle');
|
const cachedData = getCache(params?.slug, "getArticle");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// 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'
|
// Cache the data for this specific tickerID with a specific name 'getArticle'
|
||||||
setCache(params?.slug, output, 'getArticle');
|
setCache(params?.slug, output, "getArticle");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -47,7 +47,6 @@ const getDiscordWidget = async () => {
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getArticle: await getArticle(),
|
getArticle: await getArticle(),
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const actions = {
|
|||||||
login: async ({ request, locals }) => {
|
login: async ({ request, locals }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
loginUserSchema
|
loginUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -40,7 +40,7 @@ export const actions = {
|
|||||||
register: async ({ locals, request }) => {
|
register: async ({ locals, request }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
registerUserSchema
|
registerUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -94,7 +94,7 @@ await locals.pb?.collection('users').update(
|
|||||||
const redirectURL = `${url.origin}/oauth`;
|
const redirectURL = `${url.origin}/oauth`;
|
||||||
|
|
||||||
const targetItem = authMethods.authProviders?.findIndex(
|
const targetItem = authMethods.authProviders?.findIndex(
|
||||||
(item) => item?.name === providerSelected
|
(item) => item?.name === providerSelected,
|
||||||
);
|
);
|
||||||
//console.log("==================")
|
//console.log("==================")
|
||||||
//console.log(authMethods.authProviders)
|
//console.log(authMethods.authProviders)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ function removeDuplicateClasses(str) {
|
|||||||
return str.replace(
|
return str.replace(
|
||||||
/class="([^"]*)"/,
|
/class="([^"]*)"/,
|
||||||
(match, classAttr) =>
|
(match, classAttr) =>
|
||||||
`class="${[...new Set(classAttr.split(" "))].join(" ")}"`
|
`class="${[...new Set(classAttr.split(" "))].join(" ")}"`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ function addClassesToHtml(htmlString) {
|
|||||||
// Append the new class to tags that already have a class attribute, ensuring no duplicates
|
// Append the new class to tags that already have a class attribute, ensuring no duplicates
|
||||||
const regexWithClass = new RegExp(
|
const regexWithClass = new RegExp(
|
||||||
`(<${tag}[^>]*\\bclass=["'][^"']*)(?!.*\\b${className}\\b)([^"']*)["']`,
|
`(<${tag}[^>]*\\bclass=["'][^"']*)(?!.*\\b${className}\\b)([^"']*)["']`,
|
||||||
"g"
|
"g",
|
||||||
);
|
);
|
||||||
htmlString = htmlString.replace(regexWithClass, `$1 ${className}$2"`);
|
htmlString = htmlString.replace(regexWithClass, `$1 ${className}$2"`);
|
||||||
}
|
}
|
||||||
@ -58,13 +58,13 @@ function addClassesToHtml(htmlString) {
|
|||||||
// Add class to blockquote
|
// Add class to blockquote
|
||||||
htmlString = htmlString.replace(
|
htmlString = htmlString.replace(
|
||||||
/<blockquote/g,
|
/<blockquote/g,
|
||||||
'<blockquote class="pl-4 pr-4 rounded-lg bg-[#323232]"'
|
'<blockquote class="pl-4 pr-4 rounded-lg bg-[#323232]"',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add class to p inside blockquote
|
// Add class to p inside blockquote
|
||||||
htmlString = htmlString.replace(
|
htmlString = htmlString.replace(
|
||||||
/<blockquote([^>]*)>\s*<p/g,
|
/<blockquote([^>]*)>\s*<p/g,
|
||||||
`<blockquote$1>\n<p class="text-sm font-medium leading-relaxed text-white"`
|
`<blockquote$1>\n<p class="text-sm font-medium leading-relaxed text-white"`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const actions = {
|
|||||||
login: async ({ request, locals }) => {
|
login: async ({ request, locals }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
loginUserSchema
|
loginUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -40,7 +40,7 @@ export const actions = {
|
|||||||
register: async ({ locals, request }) => {
|
register: async ({ locals, request }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
registerUserSchema
|
registerUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -94,7 +94,7 @@ await locals.pb?.collection('users').update(
|
|||||||
const redirectURL = `${url.origin}/oauth`;
|
const redirectURL = `${url.origin}/oauth`;
|
||||||
|
|
||||||
const targetItem = authMethods.authProviders?.findIndex(
|
const targetItem = authMethods.authProviders?.findIndex(
|
||||||
(item) => item?.name === providerSelected
|
(item) => item?.name === providerSelected,
|
||||||
);
|
);
|
||||||
//console.log("==================")
|
//console.log("==================")
|
||||||
//console.log(authMethods.authProviders)
|
//console.log(authMethods.authProviders)
|
||||||
|
|||||||
@ -1,17 +1,15 @@
|
|||||||
import { cachedPosts } from '$lib/store';
|
import { cachedPosts } from "$lib/store";
|
||||||
|
|
||||||
import { get } from 'svelte/store';
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
export const load = async ({ parent, params }) => {
|
export const load = async ({ parent, params }) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function getOnePost() {
|
async function getOnePost() {
|
||||||
// Get the current value of cachedPosts
|
// Get the current value of cachedPosts
|
||||||
const cachedValue = get(cachedPosts);
|
const cachedValue = get(cachedPosts);
|
||||||
|
|
||||||
// Try to find the post in the cached value
|
// Try to find the post in the cached value
|
||||||
const output = cachedValue?.posts?.find(item => item?.id === params.postId) ?? {};
|
const output =
|
||||||
|
cachedValue?.posts?.find((item) => item?.id === params.postId) ?? {};
|
||||||
|
|
||||||
// If the post is found in the cache, return it
|
// If the post is found in the cache, return it
|
||||||
if (Object.keys(output).length !== 0) {
|
if (Object.keys(output).length !== 0) {
|
||||||
@ -22,10 +20,10 @@ export const load = async ({ parent, params }) => {
|
|||||||
// If the post is not found in the cache, fetch it from the endpoint
|
// If the post is not found in the cache, fetch it from the endpoint
|
||||||
const postData = { postId: params.postId };
|
const postData = { postId: params.postId };
|
||||||
|
|
||||||
const response = await fetch(fastifyURL + '/get-one-post', {
|
const response = await fetch(fastifyURL + "/get-one-post", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
@ -37,15 +35,11 @@ export const load = async ({ parent, params }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getPostId = async () => {
|
const getPostId = async () => {
|
||||||
|
|
||||||
return params.postId;
|
return params.postId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getPostId: await getPostId(),
|
getPostId: await getPostId(),
|
||||||
getOnePost: await getOnePost(),
|
getOnePost: await getOnePost(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,118 +1,105 @@
|
|||||||
import { redirect, error} from '@sveltejs/kit';
|
import { redirect, error } from "@sveltejs/kit";
|
||||||
|
|
||||||
export const load = async ({ locals}) => {
|
|
||||||
|
|
||||||
|
export const load = async ({ locals }) => {
|
||||||
if (!locals.pb.authStore.isValid) {
|
if (!locals.pb.authStore.isValid) {
|
||||||
redirect(303, '/login');
|
redirect(303, "/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSubscriptionData = async () => {
|
const getSubscriptionData = async () => {
|
||||||
const output = (await locals.pb.collection('payments').getFullList({
|
const output =
|
||||||
|
(
|
||||||
|
await locals.pb.collection("payments").getFullList({
|
||||||
filter: `user="${locals.user.id}" `,
|
filter: `user="${locals.user.id}" `,
|
||||||
sort: '-created',
|
sort: "-created",
|
||||||
}))?.at(0)?.data?.data?.attributes ?? {} ;
|
})
|
||||||
|
)?.at(0)?.data?.data?.attributes ?? {};
|
||||||
|
|
||||||
//console.log(output)
|
//console.log(output)
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getSubscriptionData: await getSubscriptionData()
|
getSubscriptionData: await getSubscriptionData(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
|
|
||||||
cancelSubscription: async ({ request, locals }) => {
|
cancelSubscription: async ({ request, locals }) => {
|
||||||
const formData = await request?.formData();
|
const formData = await request?.formData();
|
||||||
|
|
||||||
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
||||||
const subscriptionId = formData?.get('subscriptionId');
|
const subscriptionId = formData?.get("subscriptionId");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
||||||
const headers = {
|
const headers = {
|
||||||
'Accept': 'application/vnd.api+json',
|
Accept: "application/vnd.api+json",
|
||||||
'Content-Type': 'application/vnd.api+json',
|
"Content-Type": "application/vnd.api+json",
|
||||||
'Authorization': `Bearer ${apiKey}`
|
Authorization: `Bearer ${apiKey}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'DELETE',
|
method: "DELETE",
|
||||||
headers: headers
|
headers: headers,
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Error: ", err);
|
console.log("Error: ", err);
|
||||||
error(err.status, err.message);
|
error(err.status, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirect(302, "/community/profile");
|
||||||
redirect(302, '/community/profile');
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
reactivateSubscription: async ({ request, locals }) => {
|
reactivateSubscription: async ({ request, locals }) => {
|
||||||
const formData = await request?.formData();
|
const formData = await request?.formData();
|
||||||
|
|
||||||
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
||||||
const subscriptionId = formData?.get('subscriptionId');
|
const subscriptionId = formData?.get("subscriptionId");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
||||||
const headers = {
|
const headers = {
|
||||||
'Accept': 'application/vnd.api+json',
|
Accept: "application/vnd.api+json",
|
||||||
'Content-Type': 'application/vnd.api+json',
|
"Content-Type": "application/vnd.api+json",
|
||||||
'Authorization': `Bearer ${apiKey}`
|
Authorization: `Bearer ${apiKey}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
data: {
|
data: {
|
||||||
type: 'subscriptions',
|
type: "subscriptions",
|
||||||
id: `${subscriptionId}`,
|
id: `${subscriptionId}`,
|
||||||
attributes: {
|
attributes: {
|
||||||
cancelled: false
|
cancelled: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'PATCH',
|
method: "PATCH",
|
||||||
headers: headers,
|
headers: headers,
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Error: ", err);
|
console.log("Error: ", err);
|
||||||
error(err.status, err.message);
|
error(err.status, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirect(302, "/community/profile");
|
||||||
redirect(302, '/community/profile');
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeSubscription: async ({ request, locals }) => {
|
changeSubscription: async ({ request, locals }) => {
|
||||||
const formData = await request?.formData();
|
const formData = await request?.formData();
|
||||||
|
|
||||||
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
const apiKey = import.meta.env.VITE_LEMON_SQUEEZY_API_KEY;
|
||||||
const subscriptionId = formData?.get('subscriptionId');
|
const subscriptionId = formData?.get("subscriptionId");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
const url = `https://api.lemonsqueezy.com/v1/subscriptions/${subscriptionId}`;
|
||||||
const headers = {
|
const headers = {
|
||||||
'Accept': 'application/vnd.api+json',
|
Accept: "application/vnd.api+json",
|
||||||
'Content-Type': 'application/vnd.api+json',
|
"Content-Type": "application/vnd.api+json",
|
||||||
'Authorization': `Bearer ${apiKey}`
|
Authorization: `Bearer ${apiKey}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the data payload
|
// Create the data payload
|
||||||
@ -121,30 +108,23 @@ export const actions = {
|
|||||||
type: "subscriptions",
|
type: "subscriptions",
|
||||||
id: subscriptionId,
|
id: subscriptionId,
|
||||||
attributes: {
|
attributes: {
|
||||||
variant_id: import.meta.env.VITE_LEMON_SQUEEZY_ANNUAL_VARIANT_ID // Change from monthly to annually plan
|
variant_id: import.meta.env.VITE_LEMON_SQUEEZY_ANNUAL_VARIANT_ID, // Change from monthly to annually plan
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'PATCH',
|
method: "PATCH",
|
||||||
headers: headers,
|
headers: headers,
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(await response.json())
|
console.log(await response.json());
|
||||||
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Error: ", err);
|
console.log("Error: ", err);
|
||||||
error(err.status, err.message);
|
error(err.status, err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirect(302, "/community/profile");
|
||||||
redirect(302, '/community/profile');
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export const actions = {
|
|||||||
login: async ({ request, locals }) => {
|
login: async ({ request, locals }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
loginUserSchema
|
loginUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -54,7 +54,7 @@ export const actions = {
|
|||||||
register: async ({ locals, request }) => {
|
register: async ({ locals, request }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
registerUserSchema
|
registerUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -108,7 +108,7 @@ await locals.pb?.collection('users').update(
|
|||||||
const redirectURL = `${url.origin}/oauth`;
|
const redirectURL = `${url.origin}/oauth`;
|
||||||
|
|
||||||
const targetItem = authMethods.authProviders?.findIndex(
|
const targetItem = authMethods.authProviders?.findIndex(
|
||||||
(item) => item?.name === providerSelected
|
(item) => item?.name === providerSelected,
|
||||||
);
|
);
|
||||||
//console.log("==================")
|
//console.log("==================")
|
||||||
//console.log(authMethods.authProviders)
|
//console.log(authMethods.authProviders)
|
||||||
|
|||||||
@ -1,29 +1,29 @@
|
|||||||
import { getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from "$lib/store";
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
|
|
||||||
export const load = async ({parent}) => {
|
|
||||||
const getCryptoList = async () => {
|
const getCryptoList = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache('', 'getCryptoList');
|
const cachedData = getCache("", "getCryptoList");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
const response = await fetch(apiURL + "/all-crypto-tickers", {
|
||||||
const response = await fetch(apiURL + '/all-crypto-tickers', {
|
method: "GET",
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
output = (await response.json())?.sort((a, b) => b?.marketCap - a?.marketCap);
|
output = (await response.json())?.sort(
|
||||||
|
(a, b) => b?.marketCap - a?.marketCap,
|
||||||
|
);
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getCryptoList'
|
// Cache the data for this specific tickerID with a specific name 'getCryptoList'
|
||||||
setCache('', output, 'getCryptoList');
|
setCache("", output, "getCryptoList");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -31,6 +31,6 @@ export const load = async ({parent}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getCryptoList: await getCryptoList()
|
getCryptoList: await getCryptoList(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,11 +1,8 @@
|
|||||||
import { displayCompanyName, cryptoTicker, assetType} from '$lib/store';
|
import { displayCompanyName, cryptoTicker, assetType } from "$lib/store";
|
||||||
|
|
||||||
|
|
||||||
export const load = async ({ params, data }) => {
|
export const load = async ({ params, data }) => {
|
||||||
|
cryptoTicker.update((value) => params.tickerID?.toUpperCase());
|
||||||
|
assetType.update((value) => "crypto");
|
||||||
|
|
||||||
cryptoTicker.update( value => params.tickerID?.toUpperCase());
|
displayCompanyName.update((value) => data?.companyName);
|
||||||
assetType.update( value => 'crypto');
|
|
||||||
|
|
||||||
displayCompanyName.update(value => data?.companyName)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -6,7 +6,7 @@ export const actions = {
|
|||||||
login: async ({ request, locals }) => {
|
login: async ({ request, locals }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
loginUserSchema
|
loginUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -40,7 +40,7 @@ export const actions = {
|
|||||||
register: async ({ locals, request }) => {
|
register: async ({ locals, request }) => {
|
||||||
const { formData, errors } = await validateData(
|
const { formData, errors } = await validateData(
|
||||||
await request.formData(),
|
await request.formData(),
|
||||||
registerUserSchema
|
registerUserSchema,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -94,7 +94,7 @@ await locals.pb?.collection('users').update(
|
|||||||
const redirectURL = `${url.origin}/oauth`;
|
const redirectURL = `${url.origin}/oauth`;
|
||||||
|
|
||||||
const targetItem = authMethods.authProviders?.findIndex(
|
const targetItem = authMethods.authProviders?.findIndex(
|
||||||
(item) => item?.name === providerSelected
|
(item) => item?.name === providerSelected,
|
||||||
);
|
);
|
||||||
//console.log("==================")
|
//console.log("==================")
|
||||||
//console.log(authMethods.authProviders)
|
//console.log(authMethods.authProviders)
|
||||||
|
|||||||
@ -1,48 +1,41 @@
|
|||||||
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 getSenateTrading = async () => {
|
const getSenateTrading = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache(params.tickerID, 'getSenateTrading');
|
const cachedData = getCache(params.tickerID, "getSenateTrading");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID,
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/congress-trading-ticker', {
|
const response = await fetch(apiURL + "/congress-trading-ticker", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getSenateTrading'
|
// Cache the data for this specific tickerID with a specific name 'getSenateTrading'
|
||||||
setCache(params.tickerID, output, 'getSenateTrading');
|
setCache(params.tickerID, output, "getSenateTrading");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getSenateTrading: await getSenateTrading()
|
getSenateTrading: await getSenateTrading(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,35 +1,34 @@
|
|||||||
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 getStockNews = async () => {
|
const getStockNews = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache(params.tickerID, 'getStockNews');
|
const cachedData = getCache(params.tickerID, "getStockNews");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID,
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/stock-news', {
|
const response = await fetch(apiURL + "/stock-news", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getStockNews'
|
// Cache the data for this specific tickerID with a specific name 'getStockNews'
|
||||||
setCache(params.tickerID, output, 'getStockNews');
|
setCache(params.tickerID, output, "getStockNews");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -37,6 +36,6 @@ export const load = async ({ parent, params }) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getStockNews: await getStockNews()
|
getStockNews: await getStockNews(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,45 +1,41 @@
|
|||||||
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 getQuantStats = async () => {
|
const getQuantStats = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache(params.tickerID, 'getQuantStats');
|
const cachedData = getCache(params.tickerID, "getQuantStats");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
|
||||||
const postData = {
|
const postData = {
|
||||||
ticker: params.tickerID
|
ticker: params.tickerID,
|
||||||
};
|
};
|
||||||
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/get-quant-stats', {
|
const response = await fetch(apiURL + "/get-quant-stats", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getQuantStats'
|
// Cache the data for this specific tickerID with a specific name 'getQuantStats'
|
||||||
setCache(params.tickerID, output, 'getQuantStats');
|
setCache(params.tickerID, output, "getQuantStats");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(output)
|
console.log(output);
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getQuantStats: await getQuantStats()
|
getQuantStats: await getQuantStats(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,35 +2,39 @@
|
|||||||
|
|
||||||
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY;
|
||||||
|
|
||||||
async function getOneDayPrice(ticker: string, apiURL:string) {
|
async function getOneDayPrice(ticker: string, apiURL: string) {
|
||||||
|
|
||||||
let oneDayPrice = [];
|
let oneDayPrice = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const postData = { ticker: ticker };
|
const postData = { ticker: ticker };
|
||||||
const response = await fetch(apiURL + '/one-day-price', {
|
const response = await fetch(apiURL + "/one-day-price", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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),
|
||||||
});
|
});
|
||||||
|
|
||||||
oneDayPrice = await response.json();
|
oneDayPrice = await response.json();
|
||||||
|
|
||||||
oneDayPrice = oneDayPrice?.map(item => ({ time: Date.parse(item?.time), open: item?.open !== null ? item?.open : NaN, high: item?.high !== null ? item?.high : NaN, low: item?.low !== null ? item?.low : NaN, close: item?.close !== null ? item?.close : NaN}));
|
oneDayPrice = oneDayPrice?.map((item) => ({
|
||||||
|
time: Date.parse(item?.time),
|
||||||
|
open: item?.open !== null ? item?.open : NaN,
|
||||||
|
high: item?.high !== null ? item?.high : NaN,
|
||||||
|
low: item?.low !== null ? item?.low : NaN,
|
||||||
|
close: item?.close !== null ? item?.close : NaN,
|
||||||
|
}));
|
||||||
|
|
||||||
// Set worker status to finished and send chart data
|
// Set worker status to finished and send chart data
|
||||||
return oneDayPrice
|
return oneDayPrice;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Set worker status to idle and send error message
|
// Set worker status to idle and send error message
|
||||||
return oneDayPrice;
|
return oneDayPrice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getHistoricalPrice(ticker: string, apiURL: string) {
|
||||||
async function getHistoricalPrice(ticker: string, apiURL:string) {
|
|
||||||
|
|
||||||
let oneWeekPrice;
|
let oneWeekPrice;
|
||||||
let oneMonthPrice;
|
let oneMonthPrice;
|
||||||
let sixMonthPrice;
|
let sixMonthPrice;
|
||||||
@ -39,41 +43,86 @@ async function getHistoricalPrice(ticker: string, apiURL:string) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const postData = { ticker: ticker };
|
const postData = { ticker: ticker };
|
||||||
const response = await fetch(apiURL + '/historical-price', {
|
const response = await fetch(apiURL + "/historical-price", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
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),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pastPriceList = await response.json();
|
const pastPriceList = await response.json();
|
||||||
|
|
||||||
oneWeekPrice = pastPriceList['1W']?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, low, close }));
|
oneWeekPrice = pastPriceList["1W"]?.map(
|
||||||
oneMonthPrice = pastPriceList['1M']?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, low, close }));
|
({ time, open, high, low, close }) => ({
|
||||||
sixMonthPrice = pastPriceList['6M']?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, low, close }));
|
time: Date.parse(time),
|
||||||
oneYearPrice = pastPriceList['1Y']?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, low, close }));
|
open,
|
||||||
threeYearPrice = pastPriceList['MAX']?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, low, close }));
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
oneMonthPrice = pastPriceList["1M"]?.map(
|
||||||
|
({ time, open, high, low, close }) => ({
|
||||||
|
time: Date.parse(time),
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
sixMonthPrice = pastPriceList["6M"]?.map(
|
||||||
|
({ time, open, high, low, close }) => ({
|
||||||
|
time: Date.parse(time),
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
oneYearPrice = pastPriceList["1Y"]?.map(
|
||||||
|
({ time, open, high, low, close }) => ({
|
||||||
|
time: Date.parse(time),
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
threeYearPrice = pastPriceList["MAX"]?.map(
|
||||||
|
({ time, open, high, low, close }) => ({
|
||||||
|
time: Date.parse(time),
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// Set worker status to finished and send chart data
|
// Set worker status to finished and send chart data
|
||||||
return { oneWeekPrice, oneMonthPrice, sixMonthPrice, oneYearPrice, threeYearPrice, pastPriceList};
|
return {
|
||||||
|
oneWeekPrice,
|
||||||
|
oneMonthPrice,
|
||||||
|
sixMonthPrice,
|
||||||
|
oneYearPrice,
|
||||||
|
threeYearPrice,
|
||||||
|
pastPriceList,
|
||||||
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Set worker status to idle and send error message
|
// Set worker status to idle and send error message
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onmessage = async (event: MessageEvent) => {
|
onmessage = async (event: MessageEvent) => {
|
||||||
const ticker = event.data?.message?.ticker;
|
const ticker = event.data?.message?.ticker;
|
||||||
const apiURL = event.data?.message?.apiURL;
|
const apiURL = event.data?.message?.apiURL;
|
||||||
//console.log(ticker, apiURL);
|
//console.log(ticker, apiURL);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
const [output, oneDayPrice] = await Promise.all([
|
const [output, oneDayPrice] = await Promise.all([
|
||||||
getHistoricalPrice(ticker, apiURL),
|
getHistoricalPrice(ticker, apiURL),
|
||||||
getOneDayPrice(ticker, apiURL)
|
getOneDayPrice(ticker, apiURL),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const oneWeekPrice = output?.oneWeekPrice;
|
const oneWeekPrice = output?.oneWeekPrice;
|
||||||
@ -81,13 +130,21 @@ onmessage = async (event: MessageEvent) => {
|
|||||||
const sixMonthPrice = output?.sixMonthPrice;
|
const sixMonthPrice = output?.sixMonthPrice;
|
||||||
const oneYearPrice = output?.oneYearPrice;
|
const oneYearPrice = output?.oneYearPrice;
|
||||||
const threeYearPrice = output?.threeYearPrice;
|
const threeYearPrice = output?.threeYearPrice;
|
||||||
const pastPriceList = output?.pastPriceList
|
const pastPriceList = output?.pastPriceList;
|
||||||
|
|
||||||
const chartData = {oneDayPrice, oneWeekPrice, oneMonthPrice, sixMonthPrice, oneYearPrice, threeYearPrice, pastPriceList}
|
const chartData = {
|
||||||
|
oneDayPrice,
|
||||||
|
oneWeekPrice,
|
||||||
|
oneMonthPrice,
|
||||||
|
sixMonthPrice,
|
||||||
|
oneYearPrice,
|
||||||
|
threeYearPrice,
|
||||||
|
pastPriceList,
|
||||||
|
};
|
||||||
//console.log(pastPriceList)
|
//console.log(pastPriceList)
|
||||||
postMessage({ message: 'success', chartData});
|
postMessage({ message: "success", chartData });
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
postMessage({ message: 'error', e});
|
postMessage({ message: "error", e });
|
||||||
}
|
}
|
||||||
// Sending data back to the main thread
|
// Sending data back to the main thread
|
||||||
//postMessage({ message: 'Data received in the worker'});
|
//postMessage({ message: 'Data received in the worker'});
|
||||||
|
|||||||
@ -1,57 +1,77 @@
|
|||||||
import { getCache, setCache, isOpen } from '$lib/store';
|
import { getCache, setCache, isOpen } from "$lib/store";
|
||||||
|
|
||||||
|
|
||||||
const checkMarketHour = async () => {
|
const checkMarketHour = async () => {
|
||||||
const holidays = ['2024-01-01', '2024-01-15','2024-02-19','2024-03-29','2024-05-27','2024-06-19','2024-07-04','2024-09-02','2024-11-28','2024-12-25'];
|
const holidays = [
|
||||||
const currentDate = new Date().toISOString().split('T')[0];
|
"2024-01-01",
|
||||||
|
"2024-01-15",
|
||||||
|
"2024-02-19",
|
||||||
|
"2024-03-29",
|
||||||
|
"2024-05-27",
|
||||||
|
"2024-06-19",
|
||||||
|
"2024-07-04",
|
||||||
|
"2024-09-02",
|
||||||
|
"2024-11-28",
|
||||||
|
"2024-12-25",
|
||||||
|
];
|
||||||
|
const currentDate = new Date().toISOString().split("T")[0];
|
||||||
|
|
||||||
// Get the current time in the ET time zone
|
// Get the current time in the ET time zone
|
||||||
const etTimeZone = 'America/New_York';
|
const etTimeZone = "America/New_York";
|
||||||
const currentTime = new Date().toLocaleString('en-US', { timeZone: etTimeZone });
|
const currentTime = new Date().toLocaleString("en-US", {
|
||||||
|
timeZone: etTimeZone,
|
||||||
|
});
|
||||||
|
|
||||||
// Determine if the NYSE is currently open or closed
|
// Determine if the NYSE is currently open or closed
|
||||||
const currentHour = new Date(currentTime).getHours();
|
const currentHour = new Date(currentTime).getHours();
|
||||||
const isWeekendValue = new Date(currentTime).getDay() === 6 || new Date(currentTime).getDay() === 0;
|
const isWeekendValue =
|
||||||
const isBeforeMarketOpenValue = currentHour < 9 || (currentHour === 9 && new Date(currentTime).getMinutes() < 30);
|
new Date(currentTime).getDay() === 6 ||
|
||||||
|
new Date(currentTime).getDay() === 0;
|
||||||
|
const isBeforeMarketOpenValue =
|
||||||
|
currentHour < 9 ||
|
||||||
|
(currentHour === 9 && new Date(currentTime).getMinutes() < 30);
|
||||||
const isAfterMarketCloseValue = currentHour >= 16;
|
const isAfterMarketCloseValue = currentHour >= 16;
|
||||||
|
|
||||||
isOpen.set(!(isWeekendValue || isBeforeMarketOpenValue || isAfterMarketCloseValue || holidays?.includes(currentDate)));
|
isOpen.set(
|
||||||
}
|
!(
|
||||||
|
isWeekendValue ||
|
||||||
|
isBeforeMarketOpenValue ||
|
||||||
|
isAfterMarketCloseValue ||
|
||||||
|
holidays?.includes(currentDate)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
export const load = async ({parent}) => {
|
checkMarketHour();
|
||||||
|
const { apiKey, apiURL, user } = await parent();
|
||||||
checkMarketHour()
|
|
||||||
const {apiKey, apiURL, user} = await parent();
|
|
||||||
|
|
||||||
const getDarkPoolFlow = async () => {
|
const getDarkPoolFlow = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
const cachedData = getCache('', 'getDarkPoolFlow');
|
const cachedData = getCache("", "getDarkPoolFlow");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const response = await fetch(apiURL + "/dark-pool-flow", {
|
||||||
const response = await fetch(apiURL + '/dark-pool-flow', {
|
method: "GET",
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
setCache('', output, 'getDarkPoolFlow');
|
setCache("", output, "getDarkPoolFlow");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output = user?.tier !== 'Pro' ? output?.slice(0,6) : output;
|
output = user?.tier !== "Pro" ? output?.slice(0, 6) : output;
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getDarkPoolFlow: await getDarkPoolFlow()
|
getDarkPoolFlow: await getDarkPoolFlow(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,29 +1,28 @@
|
|||||||
import { getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from "$lib/store";
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
export const load = async ({parent}) => {
|
|
||||||
const getDividendCalendar = async () => {
|
const getDividendCalendar = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache('', 'getDividendCalendar');
|
const cachedData = getCache("", "getDividendCalendar");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/dividends-calendar', {
|
const response = await fetch(apiURL + "/dividends-calendar", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getDividendCalendar'
|
// Cache the data for this specific tickerID with a specific name 'getDividendCalendar'
|
||||||
setCache('', output, 'getDividendCalendar');
|
setCache("", output, "getDividendCalendar");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -31,6 +30,6 @@ export const load = async ({parent}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getDividendCalendar: await getDividendCalendar()
|
getDividendCalendar: await getDividendCalendar(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1,29 +1,28 @@
|
|||||||
import { getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from "$lib/store";
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
export const load = async ({parent}) => {
|
|
||||||
const getEarningsCalendar = async () => {
|
const getEarningsCalendar = async () => {
|
||||||
let output;
|
let output;
|
||||||
|
|
||||||
// Get cached data for the specific tickerID
|
// Get cached data for the specific tickerID
|
||||||
const cachedData = getCache('', 'getEarningsCalendar');
|
const cachedData = getCache("", "getEarningsCalendar");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
|
const { apiKey, apiURL } = await parent();
|
||||||
const {apiKey, apiURL} = await parent();
|
|
||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const response = await fetch(apiURL + '/earnings-calendar', {
|
const response = await fetch(apiURL + "/earnings-calendar", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
// Cache the data for this specific tickerID with a specific name 'getEarningsCalendar'
|
// Cache the data for this specific tickerID with a specific name 'getEarningsCalendar'
|
||||||
setCache('', output, 'getEarningsCalendar');
|
setCache("", output, "getEarningsCalendar");
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -31,6 +30,6 @@ export const load = async ({parent}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getEarningsCalendar: await getEarningsCalendar()
|
getEarningsCalendar: await getEarningsCalendar(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -41,7 +41,7 @@ const countryMap = Object.fromEntries(
|
|||||||
listOfRelevantCountries.map((entry) => {
|
listOfRelevantCountries.map((entry) => {
|
||||||
const [code, name] = Object.entries(entry)[0];
|
const [code, name] = Object.entries(entry)[0];
|
||||||
return [name, code];
|
return [name, code];
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
onmessage = async (event: MessageEvent) => {
|
onmessage = async (event: MessageEvent) => {
|
||||||
@ -53,7 +53,7 @@ onmessage = async (event: MessageEvent) => {
|
|||||||
|
|
||||||
// Filter rawData based on the mapped country codes
|
// Filter rawData based on the mapped country codes
|
||||||
const output = rawData?.map((subArray) =>
|
const output = rawData?.map((subArray) =>
|
||||||
subArray?.filter((item) => filterCodes.includes(item?.country))
|
subArray?.filter((item) => filterCodes.includes(item?.country)),
|
||||||
);
|
);
|
||||||
|
|
||||||
let finalData = { output };
|
let finalData = { output };
|
||||||
|
|||||||
@ -1,28 +1,25 @@
|
|||||||
import { getCache, setCache } from '$lib/store';
|
import { getCache, setCache } from "$lib/store";
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
|
|
||||||
export const load = async ({parent}) => {
|
|
||||||
const getEconomicIndicator = async () => {
|
const getEconomicIndicator = async () => {
|
||||||
let output;
|
let output;
|
||||||
const {apiKey, apiURL} = await parent();
|
const { apiKey, apiURL } = await parent();
|
||||||
|
|
||||||
const cachedData = getCache('', 'getEconomicIndicator');
|
const cachedData = getCache("", "getEconomicIndicator");
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
output = cachedData;
|
output = cachedData;
|
||||||
} else {
|
} else {
|
||||||
const response = await fetch(apiURL + '/economic-indicator', {
|
const response = await fetch(apiURL + "/economic-indicator", {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
"Content-Type": "application/json",
|
||||||
|
"X-API-KEY": apiKey,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
output = await response.json();
|
output = await response.json();
|
||||||
|
|
||||||
|
setCache("", output, "getEconomicIndicator");
|
||||||
setCache('', output, 'getEconomicIndicator');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -30,6 +27,6 @@ export const load = async ({parent}) => {
|
|||||||
|
|
||||||
// Make sure to return a promise
|
// Make sure to return a promise
|
||||||
return {
|
return {
|
||||||
getEconomicIndicator: await getEconomicIndicator()
|
getEconomicIndicator: await getEconomicIndicator(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
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