tinacms 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/TinaCloudProvider.d.ts +1 -1
- package/dist/hooks/create-page-plugin.d.ts +1 -1
- package/dist/index.js +234 -174
- package/dist/index.mjs +234 -174
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import React__default, { useState, useCallback, useEffect, useRef, createContext
|
|
|
10
10
|
import { createPortal } from "react-dom";
|
|
11
11
|
import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
|
|
12
12
|
import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createBasicMarksPlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createUnderlinePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
|
|
13
|
-
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton,
|
|
13
|
+
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, insertEmptyElement, useMarkToolbarButtonState, useMarkToolbarButton, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
|
|
14
14
|
import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
|
|
15
15
|
import { useSelected, useReadOnly, ReactEditor } from "slate-react";
|
|
16
16
|
import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
|
|
@@ -57,8 +57,8 @@ import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buil
|
|
|
57
57
|
import gql from "graphql-tag";
|
|
58
58
|
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
|
|
59
59
|
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
60
|
-
import * as yup from "yup";
|
|
61
60
|
import { diff } from "@graphql-inspector/core";
|
|
61
|
+
import * as yup from "yup";
|
|
62
62
|
import { NavLink, useNavigate, useLocation, useParams, Link, useSearchParams, HashRouter, Routes, Route } from "react-router-dom";
|
|
63
63
|
import { stringifyMDX } from "@tinacms/mdx";
|
|
64
64
|
const ModalProvider = ({ children }) => {
|
|
@@ -5332,7 +5332,9 @@ const Combobox = ({ cms, input, field }) => {
|
|
|
5332
5332
|
}, [value, input, optionSets]);
|
|
5333
5333
|
React.useEffect(() => {
|
|
5334
5334
|
if (field.experimental___filter && optionSets.length > 0) {
|
|
5335
|
-
setFilteredOptionsList(
|
|
5335
|
+
setFilteredOptionsList(
|
|
5336
|
+
field.experimental___filter(optionSets, void 0)
|
|
5337
|
+
);
|
|
5336
5338
|
} else {
|
|
5337
5339
|
setFilteredOptionsList(optionSets);
|
|
5338
5340
|
}
|
|
@@ -5702,7 +5704,9 @@ const Item$2 = ({
|
|
|
5702
5704
|
onClick: () => {
|
|
5703
5705
|
const state = tinaForm.finalForm.getState();
|
|
5704
5706
|
if (state.invalid === true) {
|
|
5705
|
-
cms.alerts.error(
|
|
5707
|
+
cms.alerts.error(
|
|
5708
|
+
"Cannot navigate away from an invalid form."
|
|
5709
|
+
);
|
|
5706
5710
|
return;
|
|
5707
5711
|
}
|
|
5708
5712
|
cms.dispatch({
|
|
@@ -6286,7 +6290,9 @@ const BlockListItem = ({
|
|
|
6286
6290
|
onClick: () => {
|
|
6287
6291
|
const state = tinaForm.finalForm.getState();
|
|
6288
6292
|
if (state.invalid === true) {
|
|
6289
|
-
cms.alerts.error(
|
|
6293
|
+
cms.alerts.error(
|
|
6294
|
+
"Cannot navigate away from an invalid form."
|
|
6295
|
+
);
|
|
6290
6296
|
return;
|
|
6291
6297
|
}
|
|
6292
6298
|
cms.dispatch({
|
|
@@ -6768,28 +6774,28 @@ class DaysView extends React__default.Component {
|
|
|
6768
6774
|
}
|
|
6769
6775
|
renderDayHeaders() {
|
|
6770
6776
|
const locale = this.props.viewDate.localeData();
|
|
6771
|
-
|
|
6777
|
+
const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
|
|
6772
6778
|
return /* @__PURE__ */ React__default.createElement("tr", null, dayItems);
|
|
6773
6779
|
}
|
|
6774
6780
|
renderDays() {
|
|
6775
6781
|
const date = this.props.viewDate;
|
|
6776
6782
|
const startOfMonth = date.clone().startOf("month");
|
|
6777
6783
|
const endOfMonth = date.clone().endOf("month");
|
|
6778
|
-
|
|
6779
|
-
|
|
6784
|
+
const rows = [[], [], [], [], [], []];
|
|
6785
|
+
const startDate = date.clone().subtract(1, "months");
|
|
6780
6786
|
startDate.date(startDate.daysInMonth()).startOf("week");
|
|
6781
|
-
|
|
6787
|
+
const endDate = startDate.clone().add(42, "d");
|
|
6782
6788
|
let i = 0;
|
|
6783
6789
|
while (startDate.isBefore(endDate)) {
|
|
6784
|
-
|
|
6790
|
+
const row = getRow$2(rows, i++);
|
|
6785
6791
|
row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
|
|
6786
6792
|
startDate.add(1, "d");
|
|
6787
6793
|
}
|
|
6788
6794
|
return rows.map((r, i2) => /* @__PURE__ */ React__default.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
|
|
6789
6795
|
}
|
|
6790
6796
|
renderDay(date, startOfMonth, endOfMonth) {
|
|
6791
|
-
|
|
6792
|
-
|
|
6797
|
+
const selectedDate = this.props.selectedDate;
|
|
6798
|
+
const dayProps = {
|
|
6793
6799
|
key: date.format("M_D"),
|
|
6794
6800
|
"data-value": date.date(),
|
|
6795
6801
|
"data-month": date.month(),
|
|
@@ -6843,7 +6849,7 @@ function getRow$2(rows, day) {
|
|
|
6843
6849
|
}
|
|
6844
6850
|
function getDaysOfWeek(locale) {
|
|
6845
6851
|
const first = locale.firstDayOfWeek();
|
|
6846
|
-
|
|
6852
|
+
const dow = [];
|
|
6847
6853
|
let i = 0;
|
|
6848
6854
|
locale._weekdaysMin.forEach(function(day) {
|
|
6849
6855
|
dow[(7 + i++ - first) % 7] = day;
|
|
@@ -6861,7 +6867,7 @@ class MonthsView extends React__default.Component {
|
|
|
6861
6867
|
return /* @__PURE__ */ React__default.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("tbody", null, this.renderMonths())));
|
|
6862
6868
|
}
|
|
6863
6869
|
renderNavigation() {
|
|
6864
|
-
|
|
6870
|
+
const year = this.props.viewDate.year();
|
|
6865
6871
|
return /* @__PURE__ */ React__default.createElement(
|
|
6866
6872
|
ViewNavigation,
|
|
6867
6873
|
{
|
|
@@ -6874,9 +6880,9 @@ class MonthsView extends React__default.Component {
|
|
|
6874
6880
|
);
|
|
6875
6881
|
}
|
|
6876
6882
|
renderMonths() {
|
|
6877
|
-
|
|
6883
|
+
const rows = [[], [], []];
|
|
6878
6884
|
for (let month = 0; month < 12; month++) {
|
|
6879
|
-
|
|
6885
|
+
const row = getRow$1(rows, month);
|
|
6880
6886
|
row.push(this.renderMonth(month));
|
|
6881
6887
|
}
|
|
6882
6888
|
return rows.map((months, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, months));
|
|
@@ -6893,7 +6899,7 @@ class MonthsView extends React__default.Component {
|
|
|
6893
6899
|
if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
|
|
6894
6900
|
className += " rdtActive";
|
|
6895
6901
|
}
|
|
6896
|
-
|
|
6902
|
+
const props = { key: month, className, "data-value": month, onClick };
|
|
6897
6903
|
if (this.props.renderMonth) {
|
|
6898
6904
|
return this.props.renderMonth(
|
|
6899
6905
|
props,
|
|
@@ -6905,11 +6911,11 @@ class MonthsView extends React__default.Component {
|
|
|
6905
6911
|
return /* @__PURE__ */ React__default.createElement("td", { ...props }, this.getMonthText(month));
|
|
6906
6912
|
}
|
|
6907
6913
|
isDisabledMonth(month) {
|
|
6908
|
-
|
|
6914
|
+
const isValidDate = this.props.isValidDate;
|
|
6909
6915
|
if (!isValidDate) {
|
|
6910
6916
|
return false;
|
|
6911
6917
|
}
|
|
6912
|
-
|
|
6918
|
+
const date = this.props.viewDate.clone().set({ month });
|
|
6913
6919
|
let day = date.endOf("month").date() + 1;
|
|
6914
6920
|
while (day-- > 1) {
|
|
6915
6921
|
if (isValidDate(date.date(day))) {
|
|
@@ -6961,9 +6967,9 @@ class YearsView extends React__default.Component {
|
|
|
6961
6967
|
}
|
|
6962
6968
|
renderYears() {
|
|
6963
6969
|
const viewYear = this.getViewYear();
|
|
6964
|
-
|
|
6970
|
+
const rows = [[], [], []];
|
|
6965
6971
|
for (let year = viewYear - 1; year < viewYear + 11; year++) {
|
|
6966
|
-
|
|
6972
|
+
const row = getRow(rows, year - viewYear);
|
|
6967
6973
|
row.push(this.renderYear(year));
|
|
6968
6974
|
}
|
|
6969
6975
|
return rows.map((years, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, years));
|
|
@@ -6980,7 +6986,7 @@ class YearsView extends React__default.Component {
|
|
|
6980
6986
|
if (selectedYear === year) {
|
|
6981
6987
|
className += " rdtActive";
|
|
6982
6988
|
}
|
|
6983
|
-
|
|
6989
|
+
const props = { key: year, className, "data-value": year, onClick };
|
|
6984
6990
|
return this.props.renderYear(
|
|
6985
6991
|
props,
|
|
6986
6992
|
year,
|
|
@@ -6994,15 +7000,15 @@ class YearsView extends React__default.Component {
|
|
|
6994
7000
|
return this.props.selectedDate && this.props.selectedDate.year();
|
|
6995
7001
|
}
|
|
6996
7002
|
isDisabledYear(year) {
|
|
6997
|
-
|
|
7003
|
+
const cache = this.disabledYearsCache;
|
|
6998
7004
|
if (cache[year] !== void 0) {
|
|
6999
7005
|
return cache[year];
|
|
7000
7006
|
}
|
|
7001
|
-
|
|
7007
|
+
const isValidDate = this.props.isValidDate;
|
|
7002
7008
|
if (!isValidDate) {
|
|
7003
7009
|
return false;
|
|
7004
7010
|
}
|
|
7005
|
-
|
|
7011
|
+
const date = this.props.viewDate.clone().set({ year });
|
|
7006
7012
|
let day = date.endOf("year").dayOfYear() + 1;
|
|
7007
7013
|
while (day-- > 1) {
|
|
7008
7014
|
if (isValidDate(date.dayOfYear(day))) {
|
|
@@ -7049,7 +7055,7 @@ const timeConstraints = {
|
|
|
7049
7055
|
}
|
|
7050
7056
|
};
|
|
7051
7057
|
function createConstraints(overrideTimeConstraints) {
|
|
7052
|
-
|
|
7058
|
+
const constraints = {};
|
|
7053
7059
|
Object.keys(timeConstraints).forEach((type) => {
|
|
7054
7060
|
constraints[type] = {
|
|
7055
7061
|
...timeConstraints[type],
|
|
@@ -7065,7 +7071,7 @@ class TimeView extends React__default.Component {
|
|
|
7065
7071
|
this.state = this.getTimeParts(props.selectedDate || props.viewDate);
|
|
7066
7072
|
}
|
|
7067
7073
|
render() {
|
|
7068
|
-
|
|
7074
|
+
const items2 = [];
|
|
7069
7075
|
const timeParts = this.state;
|
|
7070
7076
|
this.getCounters().forEach((c, i) => {
|
|
7071
7077
|
if (i && c !== "ampm") {
|
|
@@ -7127,8 +7133,8 @@ class TimeView extends React__default.Component {
|
|
|
7127
7133
|
}
|
|
7128
7134
|
if (type === "ampm")
|
|
7129
7135
|
return this.toggleDayPart();
|
|
7130
|
-
|
|
7131
|
-
|
|
7136
|
+
const update = {};
|
|
7137
|
+
const body = document.body;
|
|
7132
7138
|
update[type] = this[action](type);
|
|
7133
7139
|
this.setState(update);
|
|
7134
7140
|
this.timer = setTimeout(() => {
|
|
@@ -7171,8 +7177,8 @@ class TimeView extends React__default.Component {
|
|
|
7171
7177
|
return pad(type, value);
|
|
7172
7178
|
}
|
|
7173
7179
|
getCounters() {
|
|
7174
|
-
|
|
7175
|
-
|
|
7180
|
+
const counters = [];
|
|
7181
|
+
const format2 = this.props.timeFormat;
|
|
7176
7182
|
if (format2.toLowerCase().indexOf("h") !== -1) {
|
|
7177
7183
|
counters.push("hours");
|
|
7178
7184
|
if (format2.indexOf("m") !== -1) {
|
|
@@ -7304,7 +7310,7 @@ class Datetime extends React__default.Component {
|
|
|
7304
7310
|
__publicField(this, "_renderCalendar", () => {
|
|
7305
7311
|
const props = this.props;
|
|
7306
7312
|
const state = this.state;
|
|
7307
|
-
|
|
7313
|
+
const viewProps = {
|
|
7308
7314
|
viewDate: state.viewDate.clone(),
|
|
7309
7315
|
selectedDate: this.getSelectedDate(),
|
|
7310
7316
|
isValidDate: props.isValidDate,
|
|
@@ -7347,10 +7353,10 @@ class Datetime extends React__default.Component {
|
|
|
7347
7353
|
__publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
|
|
7348
7354
|
__publicField(this, "nextView", { days: "time", months: "days", years: "months" });
|
|
7349
7355
|
__publicField(this, "_updateDate", (e) => {
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7356
|
+
const state = this.state;
|
|
7357
|
+
const currentView = state.currentView;
|
|
7358
|
+
const updateOnView = this.getUpdateOn(this.getFormat("date"));
|
|
7359
|
+
const viewDate = this.state.viewDate.clone();
|
|
7354
7360
|
viewDate[this.viewToMethod[currentView]](
|
|
7355
7361
|
parseInt(e.target.getAttribute("data-value"), 10)
|
|
7356
7362
|
);
|
|
@@ -7358,7 +7364,7 @@ class Datetime extends React__default.Component {
|
|
|
7358
7364
|
viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
|
|
7359
7365
|
viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
|
|
7360
7366
|
}
|
|
7361
|
-
|
|
7367
|
+
const update = { viewDate };
|
|
7362
7368
|
if (currentView === updateOnView) {
|
|
7363
7369
|
update.selectedDate = viewDate.clone();
|
|
7364
7370
|
update.inputValue = viewDate.format(this.getFormat("datetime"));
|
|
@@ -7372,7 +7378,7 @@ class Datetime extends React__default.Component {
|
|
|
7372
7378
|
this.setState(update);
|
|
7373
7379
|
});
|
|
7374
7380
|
__publicField(this, "_viewNavigate", (modifier, unit) => {
|
|
7375
|
-
|
|
7381
|
+
const viewDate = this.state.viewDate.clone();
|
|
7376
7382
|
viewDate.add(modifier, unit);
|
|
7377
7383
|
if (modifier > 0) {
|
|
7378
7384
|
this.props.onNavigateForward(modifier, unit);
|
|
@@ -7382,7 +7388,7 @@ class Datetime extends React__default.Component {
|
|
|
7382
7388
|
this.setState({ viewDate });
|
|
7383
7389
|
});
|
|
7384
7390
|
__publicField(this, "_setTime", (type, value) => {
|
|
7385
|
-
|
|
7391
|
+
const date = (this.getSelectedDate() || this.state.viewDate).clone();
|
|
7386
7392
|
date[type](value);
|
|
7387
7393
|
if (!this.props.value) {
|
|
7388
7394
|
this.setState({
|
|
@@ -7406,7 +7412,7 @@ class Datetime extends React__default.Component {
|
|
|
7406
7412
|
});
|
|
7407
7413
|
});
|
|
7408
7414
|
__publicField(this, "_handleClickOutside", () => {
|
|
7409
|
-
|
|
7415
|
+
const props = this.props;
|
|
7410
7416
|
if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
|
|
7411
7417
|
this._closeCalendar();
|
|
7412
7418
|
}
|
|
@@ -7421,7 +7427,7 @@ class Datetime extends React__default.Component {
|
|
|
7421
7427
|
return;
|
|
7422
7428
|
const value = e.target ? e.target.value : e;
|
|
7423
7429
|
const localMoment = this.localMoment(value, this.getFormat("datetime"));
|
|
7424
|
-
|
|
7430
|
+
const update = { inputValue: value };
|
|
7425
7431
|
if (localMoment.isValid()) {
|
|
7426
7432
|
update.selectedDate = localMoment;
|
|
7427
7433
|
update.viewDate = localMoment.clone().startOf("month");
|
|
@@ -7485,9 +7491,9 @@ class Datetime extends React__default.Component {
|
|
|
7485
7491
|
return this.props.renderView(this.state.currentView, this._renderCalendar);
|
|
7486
7492
|
}
|
|
7487
7493
|
getInitialState() {
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7494
|
+
const props = this.props;
|
|
7495
|
+
const inputFormat = this.getFormat("datetime");
|
|
7496
|
+
const selectedDate = this.parseDate(
|
|
7491
7497
|
props.value || props.initialValue,
|
|
7492
7498
|
inputFormat
|
|
7493
7499
|
);
|
|
@@ -7518,7 +7524,7 @@ class Datetime extends React__default.Component {
|
|
|
7518
7524
|
return this.getInitialDate();
|
|
7519
7525
|
}
|
|
7520
7526
|
getInitialDate() {
|
|
7521
|
-
|
|
7527
|
+
const m = this.localMoment();
|
|
7522
7528
|
m.hour(0).minute(0).second(0).millisecond(0);
|
|
7523
7529
|
return m;
|
|
7524
7530
|
}
|
|
@@ -7538,8 +7544,8 @@ class Datetime extends React__default.Component {
|
|
|
7538
7544
|
}
|
|
7539
7545
|
getClassName() {
|
|
7540
7546
|
let cn2 = "rdt";
|
|
7541
|
-
|
|
7542
|
-
|
|
7547
|
+
const props = this.props;
|
|
7548
|
+
const propCn = props.className;
|
|
7543
7549
|
if (Array.isArray(propCn)) {
|
|
7544
7550
|
cn2 += " " + propCn.join(" ");
|
|
7545
7551
|
} else if (propCn) {
|
|
@@ -7572,14 +7578,14 @@ class Datetime extends React__default.Component {
|
|
|
7572
7578
|
return viewModes.DAYS;
|
|
7573
7579
|
}
|
|
7574
7580
|
getLocaleData() {
|
|
7575
|
-
|
|
7581
|
+
const p = this.props;
|
|
7576
7582
|
return this.localMoment(
|
|
7577
7583
|
p.value || p.defaultValue || /* @__PURE__ */ new Date()
|
|
7578
7584
|
).localeData();
|
|
7579
7585
|
}
|
|
7580
7586
|
getDateFormat() {
|
|
7581
7587
|
const locale = this.getLocaleData();
|
|
7582
|
-
|
|
7588
|
+
const format2 = this.props.dateFormat;
|
|
7583
7589
|
if (format2 === true)
|
|
7584
7590
|
return locale.longDateFormat("L");
|
|
7585
7591
|
if (format2)
|
|
@@ -7588,7 +7594,7 @@ class Datetime extends React__default.Component {
|
|
|
7588
7594
|
}
|
|
7589
7595
|
getTimeFormat() {
|
|
7590
7596
|
const locale = this.getLocaleData();
|
|
7591
|
-
|
|
7597
|
+
const format2 = this.props.timeFormat;
|
|
7592
7598
|
if (format2 === true) {
|
|
7593
7599
|
return locale.longDateFormat("LT");
|
|
7594
7600
|
}
|
|
@@ -7600,12 +7606,12 @@ class Datetime extends React__default.Component {
|
|
|
7600
7606
|
} else if (type === "time") {
|
|
7601
7607
|
return this.getTimeFormat();
|
|
7602
7608
|
}
|
|
7603
|
-
|
|
7604
|
-
|
|
7609
|
+
const dateFormat = this.getDateFormat();
|
|
7610
|
+
const timeFormat = this.getTimeFormat();
|
|
7605
7611
|
return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
|
|
7606
7612
|
}
|
|
7607
7613
|
updateTime(op, amount, type, toSelected) {
|
|
7608
|
-
|
|
7614
|
+
const update = {};
|
|
7609
7615
|
const date = toSelected ? "selectedDate" : "viewDate";
|
|
7610
7616
|
update[date] = this.state[date].clone()[op](amount, type);
|
|
7611
7617
|
this.setState(update);
|
|
@@ -7638,7 +7644,7 @@ class Datetime extends React__default.Component {
|
|
|
7638
7644
|
if (prevProps === this.props)
|
|
7639
7645
|
return;
|
|
7640
7646
|
let needsUpdate = false;
|
|
7641
|
-
|
|
7647
|
+
const thisProps = this.props;
|
|
7642
7648
|
["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
|
|
7643
7649
|
function(p) {
|
|
7644
7650
|
prevProps[p] !== thisProps[p] && (needsUpdate = true);
|
|
@@ -7654,8 +7660,8 @@ class Datetime extends React__default.Component {
|
|
|
7654
7660
|
}
|
|
7655
7661
|
regenerateDates() {
|
|
7656
7662
|
const props = this.props;
|
|
7657
|
-
|
|
7658
|
-
|
|
7663
|
+
const viewDate = this.state.viewDate.clone();
|
|
7664
|
+
const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
|
|
7659
7665
|
if (props.locale) {
|
|
7660
7666
|
viewDate.locale(props.locale);
|
|
7661
7667
|
selectedDate && selectedDate.locale(props.locale);
|
|
@@ -7670,7 +7676,7 @@ class Datetime extends React__default.Component {
|
|
|
7670
7676
|
viewDate.locale();
|
|
7671
7677
|
selectedDate && selectedDate.locale();
|
|
7672
7678
|
}
|
|
7673
|
-
|
|
7679
|
+
const update = { viewDate, selectedDate };
|
|
7674
7680
|
if (selectedDate && selectedDate.isValid()) {
|
|
7675
7681
|
update.inputValue = selectedDate.format(this.getFormat("datetime"));
|
|
7676
7682
|
}
|
|
@@ -7679,7 +7685,7 @@ class Datetime extends React__default.Component {
|
|
|
7679
7685
|
getSelectedDate() {
|
|
7680
7686
|
if (this.props.value === void 0)
|
|
7681
7687
|
return this.state.selectedDate;
|
|
7682
|
-
|
|
7688
|
+
const selectedDate = this.parseDate(
|
|
7683
7689
|
this.props.value,
|
|
7684
7690
|
this.getFormat("datetime")
|
|
7685
7691
|
);
|
|
@@ -7698,7 +7704,7 @@ class Datetime extends React__default.Component {
|
|
|
7698
7704
|
return "";
|
|
7699
7705
|
}
|
|
7700
7706
|
getInputValue() {
|
|
7701
|
-
|
|
7707
|
+
const selectedDate = this.getSelectedDate();
|
|
7702
7708
|
return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
|
|
7703
7709
|
}
|
|
7704
7710
|
/**
|
|
@@ -7708,7 +7714,7 @@ class Datetime extends React__default.Component {
|
|
|
7708
7714
|
* @public
|
|
7709
7715
|
*/
|
|
7710
7716
|
setViewDate(date) {
|
|
7711
|
-
|
|
7717
|
+
const logError = function() {
|
|
7712
7718
|
return log("Invalid date passed to the `setViewDate` method: " + date);
|
|
7713
7719
|
};
|
|
7714
7720
|
if (!date)
|
|
@@ -7804,7 +7810,7 @@ __publicField(Datetime, "defaultProps", {
|
|
|
7804
7810
|
// Make moment accessible through the Datetime class
|
|
7805
7811
|
__publicField(Datetime, "moment", moment);
|
|
7806
7812
|
function log(message, method) {
|
|
7807
|
-
|
|
7813
|
+
const con = typeof window !== "undefined" && window.console;
|
|
7808
7814
|
if (!con)
|
|
7809
7815
|
return;
|
|
7810
7816
|
if (!method) {
|
|
@@ -8627,7 +8633,10 @@ const BranchSelector = ({
|
|
|
8627
8633
|
label: "View in GitHub",
|
|
8628
8634
|
Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
|
|
8629
8635
|
onMouseDown: () => {
|
|
8630
|
-
window.open(
|
|
8636
|
+
window.open(
|
|
8637
|
+
branch.githubPullRequestUrl,
|
|
8638
|
+
"_blank"
|
|
8639
|
+
);
|
|
8631
8640
|
}
|
|
8632
8641
|
},
|
|
8633
8642
|
typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
|
|
@@ -8933,7 +8942,9 @@ class EventBus {
|
|
|
8933
8942
|
} else {
|
|
8934
8943
|
events = event;
|
|
8935
8944
|
}
|
|
8936
|
-
const newListeners = events.map(
|
|
8945
|
+
const newListeners = events.map(
|
|
8946
|
+
(event2) => new Listener(event2, callback)
|
|
8947
|
+
);
|
|
8937
8948
|
newListeners.forEach((newListener) => this.listeners.add(newListener));
|
|
8938
8949
|
return () => {
|
|
8939
8950
|
newListeners.forEach((listener) => this.listeners.delete(listener));
|
|
@@ -9289,9 +9300,7 @@ class TinaMediaStore {
|
|
|
9289
9300
|
const deleteStartTime = Date.now();
|
|
9290
9301
|
while (true) {
|
|
9291
9302
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
9292
|
-
const { error, message } = await this.api.getRequestStatus(
|
|
9293
|
-
requestId
|
|
9294
|
-
);
|
|
9303
|
+
const { error, message } = await this.api.getRequestStatus(requestId);
|
|
9295
9304
|
if (error !== void 0) {
|
|
9296
9305
|
if (error) {
|
|
9297
9306
|
throw new Error(message);
|
|
@@ -10220,7 +10229,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10220
10229
|
"Event Log"
|
|
10221
10230
|
));
|
|
10222
10231
|
};
|
|
10223
|
-
const version = "2.7.
|
|
10232
|
+
const version = "2.7.3";
|
|
10224
10233
|
const Nav = ({
|
|
10225
10234
|
isLocalMode,
|
|
10226
10235
|
className = "",
|
|
@@ -10856,7 +10865,7 @@ const SidebarHeader = ({
|
|
|
10856
10865
|
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
10857
10866
|
stroke: "currentColor",
|
|
10858
10867
|
fill: "currentColor",
|
|
10859
|
-
|
|
10868
|
+
strokeWidth: "0",
|
|
10860
10869
|
viewBox: "0 0 24 24",
|
|
10861
10870
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10862
10871
|
},
|
|
@@ -11446,7 +11455,10 @@ function MediaPicker({
|
|
|
11446
11455
|
const observer = new IntersectionObserver((entries) => {
|
|
11447
11456
|
const target = entries[0];
|
|
11448
11457
|
if (target.isIntersecting && list.nextOffset) {
|
|
11449
|
-
setOffsetHistory((offsetHistory2) => [
|
|
11458
|
+
setOffsetHistory((offsetHistory2) => [
|
|
11459
|
+
...offsetHistory2,
|
|
11460
|
+
list.nextOffset
|
|
11461
|
+
]);
|
|
11450
11462
|
}
|
|
11451
11463
|
});
|
|
11452
11464
|
if (loaderRef.current) {
|
|
@@ -12410,7 +12422,9 @@ const ActiveFieldIndicator = () => {
|
|
|
12410
12422
|
if (activeEle) {
|
|
12411
12423
|
setDisplay(true);
|
|
12412
12424
|
setPosition(activeEle.getBoundingClientRect());
|
|
12413
|
-
const iframe = document.getElementById(
|
|
12425
|
+
const iframe = document.getElementById(
|
|
12426
|
+
"tina-iframe"
|
|
12427
|
+
);
|
|
12414
12428
|
if (iframe) {
|
|
12415
12429
|
setIframePosition(iframe.getBoundingClientRect());
|
|
12416
12430
|
}
|
|
@@ -13028,7 +13042,9 @@ const ImgEmbed = ({
|
|
|
13028
13042
|
const { fieldName } = useTemplates();
|
|
13029
13043
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13030
13044
|
useHotkey("enter", () => {
|
|
13031
|
-
insertNodes(editor, [
|
|
13045
|
+
insertNodes(editor, [
|
|
13046
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13047
|
+
]);
|
|
13032
13048
|
});
|
|
13033
13049
|
return /* @__PURE__ */ React__default.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React__default.createElement(
|
|
13034
13050
|
"div",
|
|
@@ -13171,7 +13187,9 @@ const InlineEmbed = ({
|
|
|
13171
13187
|
const { templates, fieldName } = useTemplates();
|
|
13172
13188
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13173
13189
|
useHotkey("enter", () => {
|
|
13174
|
-
insertNodes(editor, [
|
|
13190
|
+
insertNodes(editor, [
|
|
13191
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13192
|
+
]);
|
|
13175
13193
|
});
|
|
13176
13194
|
useHotkey("space", () => {
|
|
13177
13195
|
insertNodes(editor, [{ text: " " }], {
|
|
@@ -13227,7 +13245,9 @@ const BlockEmbed = ({
|
|
|
13227
13245
|
const { templates, fieldName } = useTemplates();
|
|
13228
13246
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13229
13247
|
useHotkey("enter", () => {
|
|
13230
|
-
insertNodes(editor, [
|
|
13248
|
+
insertNodes(editor, [
|
|
13249
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13250
|
+
]);
|
|
13231
13251
|
});
|
|
13232
13252
|
const activeTemplate = templates.find(
|
|
13233
13253
|
(template) => template.name === element.name
|
|
@@ -14086,7 +14106,9 @@ const EMBED_ICON_WIDTH = 78;
|
|
|
14086
14106
|
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14087
14107
|
const FLOAT_BUTTON_WIDTH = 25;
|
|
14088
14108
|
const HEADING_LABEL = "Headings";
|
|
14089
|
-
const ToolbarContext = createContext(
|
|
14109
|
+
const ToolbarContext = createContext(
|
|
14110
|
+
void 0
|
|
14111
|
+
);
|
|
14090
14112
|
const ToolbarProvider = ({
|
|
14091
14113
|
tinaForm,
|
|
14092
14114
|
templates,
|
|
@@ -14236,7 +14258,7 @@ const useCodeBlockToolbarButton = (state) => {
|
|
|
14236
14258
|
const CodeBlockToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14237
14259
|
const state = useCodeBlockToolbarButtonState();
|
|
14238
14260
|
const { props } = useCodeBlockToolbarButton(state);
|
|
14239
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14261
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.codeBlock, null));
|
|
14240
14262
|
});
|
|
14241
14263
|
const useImageToolbarButtonState = () => {
|
|
14242
14264
|
const editor = useEditorState();
|
|
@@ -14268,36 +14290,54 @@ const useImageToolbarButton = (state) => {
|
|
|
14268
14290
|
const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14269
14291
|
const state = useImageToolbarButtonState();
|
|
14270
14292
|
const { props } = useImageToolbarButton(state);
|
|
14271
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14272
|
-
});
|
|
14273
|
-
const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
|
|
14274
|
-
const editor = useEditorState();
|
|
14275
|
-
const state = useListToolbarButtonState({ nodeType });
|
|
14276
|
-
const { props } = useListToolbarButton(state);
|
|
14277
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14278
|
-
ToolbarButton,
|
|
14279
|
-
{
|
|
14280
|
-
ref,
|
|
14281
|
-
tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14282
|
-
...props,
|
|
14283
|
-
onClick: (e) => {
|
|
14284
|
-
e.preventDefault();
|
|
14285
|
-
e.stopPropagation();
|
|
14286
|
-
toggleList(editor, { type: nodeType });
|
|
14287
|
-
}
|
|
14288
|
-
},
|
|
14289
|
-
nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14290
|
-
);
|
|
14293
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
|
|
14291
14294
|
});
|
|
14295
|
+
const UnorderedListToolbarButton = withRef(
|
|
14296
|
+
(props, ref) => {
|
|
14297
|
+
const editor = useEditorState();
|
|
14298
|
+
const state = useListToolbarButtonState({ nodeType: ELEMENT_UL });
|
|
14299
|
+
const { props: buttonProps } = useListToolbarButton(state);
|
|
14300
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14301
|
+
ToolbarButton,
|
|
14302
|
+
{
|
|
14303
|
+
ref,
|
|
14304
|
+
tooltip: "Bulleted List",
|
|
14305
|
+
...buttonProps,
|
|
14306
|
+
onClick: (e) => {
|
|
14307
|
+
e.preventDefault();
|
|
14308
|
+
e.stopPropagation();
|
|
14309
|
+
toggleList(editor, { type: ELEMENT_UL });
|
|
14310
|
+
}
|
|
14311
|
+
},
|
|
14312
|
+
/* @__PURE__ */ React__default.createElement(Icons.ul, null)
|
|
14313
|
+
);
|
|
14314
|
+
}
|
|
14315
|
+
);
|
|
14316
|
+
const OrderedListToolbarButton = withRef(
|
|
14317
|
+
(props, ref) => {
|
|
14318
|
+
const editor = useEditorState();
|
|
14319
|
+
const state = useListToolbarButtonState({ nodeType: ELEMENT_OL });
|
|
14320
|
+
const { props: buttonProps } = useListToolbarButton(state);
|
|
14321
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14322
|
+
ToolbarButton,
|
|
14323
|
+
{
|
|
14324
|
+
ref,
|
|
14325
|
+
tooltip: "Numbered List",
|
|
14326
|
+
...buttonProps,
|
|
14327
|
+
onClick: (e) => {
|
|
14328
|
+
e.preventDefault();
|
|
14329
|
+
e.stopPropagation();
|
|
14330
|
+
toggleList(editor, { type: ELEMENT_OL });
|
|
14331
|
+
}
|
|
14332
|
+
},
|
|
14333
|
+
/* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14334
|
+
);
|
|
14335
|
+
}
|
|
14336
|
+
);
|
|
14292
14337
|
const LinkToolbarButton = withRef((rest, ref) => {
|
|
14293
14338
|
const state = useLinkToolbarButtonState();
|
|
14294
14339
|
const { props } = useLinkToolbarButton(state);
|
|
14295
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link"
|
|
14296
|
-
});
|
|
14297
|
-
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14298
|
-
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14299
|
-
const { props } = useMarkToolbarButton(state);
|
|
14300
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14340
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
|
|
14301
14341
|
});
|
|
14302
14342
|
const useMermaidToolbarButtonState = () => {
|
|
14303
14343
|
const editor = useEditorState();
|
|
@@ -14378,7 +14418,7 @@ const useBlockQuoteToolbarButton = (state) => {
|
|
|
14378
14418
|
const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14379
14419
|
const state = useBlockQuoteToolbarButtonState();
|
|
14380
14420
|
const { props } = useBlockQuoteToolbarButton(state);
|
|
14381
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14421
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
|
|
14382
14422
|
});
|
|
14383
14423
|
const useRawMarkdownToolbarButton = () => {
|
|
14384
14424
|
const { setRawMode } = useEditorContext();
|
|
@@ -14398,7 +14438,7 @@ const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
|
14398
14438
|
ToolbarButton,
|
|
14399
14439
|
{
|
|
14400
14440
|
ref,
|
|
14401
|
-
tooltip: "
|
|
14441
|
+
tooltip: "Raw Markdown",
|
|
14402
14442
|
...rest,
|
|
14403
14443
|
...props,
|
|
14404
14444
|
"data-testid": "markdown-button"
|
|
@@ -14551,6 +14591,15 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
14551
14591
|
template.label || template.name
|
|
14552
14592
|
))));
|
|
14553
14593
|
};
|
|
14594
|
+
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14595
|
+
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14596
|
+
const { props } = useMarkToolbarButton(state);
|
|
14597
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14598
|
+
});
|
|
14599
|
+
const BoldToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null));
|
|
14600
|
+
const StrikethroughToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: MARK_STRIKETHROUGH }, /* @__PURE__ */ React__default.createElement(Icons.strikethrough, null));
|
|
14601
|
+
const ItalicToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null));
|
|
14602
|
+
const CodeToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null));
|
|
14554
14603
|
const toolbarItems = {
|
|
14555
14604
|
heading: {
|
|
14556
14605
|
label: HEADING_LABEL,
|
|
@@ -14571,37 +14620,37 @@ const toolbarItems = {
|
|
|
14571
14620
|
quote: {
|
|
14572
14621
|
label: "Quote",
|
|
14573
14622
|
width: () => STANDARD_ICON_WIDTH,
|
|
14574
|
-
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton,
|
|
14623
|
+
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, null)
|
|
14575
14624
|
},
|
|
14576
14625
|
ul: {
|
|
14577
14626
|
label: "Unordered List",
|
|
14578
14627
|
width: () => STANDARD_ICON_WIDTH,
|
|
14579
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14628
|
+
Component: /* @__PURE__ */ React__default.createElement(UnorderedListToolbarButton, null)
|
|
14580
14629
|
},
|
|
14581
14630
|
ol: {
|
|
14582
14631
|
label: "Ordered List",
|
|
14583
14632
|
width: () => STANDARD_ICON_WIDTH,
|
|
14584
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14633
|
+
Component: /* @__PURE__ */ React__default.createElement(OrderedListToolbarButton, null)
|
|
14585
14634
|
},
|
|
14586
14635
|
bold: {
|
|
14587
14636
|
label: "Bold",
|
|
14588
14637
|
width: () => STANDARD_ICON_WIDTH,
|
|
14589
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14638
|
+
Component: /* @__PURE__ */ React__default.createElement(BoldToolbarButton, null)
|
|
14590
14639
|
},
|
|
14591
14640
|
strikethrough: {
|
|
14592
14641
|
label: "Strikethrough",
|
|
14593
14642
|
width: () => STANDARD_ICON_WIDTH,
|
|
14594
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14643
|
+
Component: /* @__PURE__ */ React__default.createElement(StrikethroughToolbarButton, null)
|
|
14595
14644
|
},
|
|
14596
14645
|
italic: {
|
|
14597
14646
|
label: "Italic",
|
|
14598
14647
|
width: () => STANDARD_ICON_WIDTH,
|
|
14599
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14648
|
+
Component: /* @__PURE__ */ React__default.createElement(ItalicToolbarButton, null)
|
|
14600
14649
|
},
|
|
14601
14650
|
code: {
|
|
14602
14651
|
label: "Code",
|
|
14603
14652
|
width: () => STANDARD_ICON_WIDTH,
|
|
14604
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14653
|
+
Component: /* @__PURE__ */ React__default.createElement(CodeToolbarButton, null)
|
|
14605
14654
|
},
|
|
14606
14655
|
codeBlock: {
|
|
14607
14656
|
label: "Code Block",
|
|
@@ -30271,7 +30320,14 @@ const TINA_LOGIN_EVENT = "tinaCloudLogin";
|
|
|
30271
30320
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
30272
30321
|
const authenticate = (clientId, frontendUrl) => {
|
|
30273
30322
|
return new Promise((resolve) => {
|
|
30274
|
-
|
|
30323
|
+
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30324
|
+
const authTab = popupWindow(
|
|
30325
|
+
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30326
|
+
"_blank",
|
|
30327
|
+
window,
|
|
30328
|
+
1e3,
|
|
30329
|
+
700
|
|
30330
|
+
);
|
|
30275
30331
|
window.addEventListener("message", function(e) {
|
|
30276
30332
|
if (e.data.source === TINA_LOGIN_EVENT) {
|
|
30277
30333
|
if (authTab) {
|
|
@@ -30284,14 +30340,6 @@ const authenticate = (clientId, frontendUrl) => {
|
|
|
30284
30340
|
});
|
|
30285
30341
|
}
|
|
30286
30342
|
});
|
|
30287
|
-
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30288
|
-
authTab = popupWindow(
|
|
30289
|
-
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30290
|
-
"_blank",
|
|
30291
|
-
window,
|
|
30292
|
-
1e3,
|
|
30293
|
-
700
|
|
30294
|
-
);
|
|
30295
30343
|
});
|
|
30296
30344
|
};
|
|
30297
30345
|
const DefaultSessionProvider = ({
|
|
@@ -30997,56 +31045,6 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
30997
31045
|
!submitting && name
|
|
30998
31046
|
);
|
|
30999
31047
|
};
|
|
31000
|
-
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31001
|
-
const useTinaAuthRedirect = () => {
|
|
31002
|
-
useEffect(() => {
|
|
31003
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
31004
|
-
const config = {
|
|
31005
|
-
code: urlParams.get("code") || "",
|
|
31006
|
-
scope: urlParams.get("scope") || "email",
|
|
31007
|
-
state: urlParams.get("state")
|
|
31008
|
-
};
|
|
31009
|
-
if (!config.code) {
|
|
31010
|
-
return;
|
|
31011
|
-
}
|
|
31012
|
-
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31013
|
-
}, []);
|
|
31014
|
-
};
|
|
31015
|
-
const createClient = ({
|
|
31016
|
-
clientId,
|
|
31017
|
-
isLocalClient = true,
|
|
31018
|
-
branch,
|
|
31019
|
-
tinaioConfig,
|
|
31020
|
-
schema,
|
|
31021
|
-
apiUrl,
|
|
31022
|
-
tinaGraphQLVersion
|
|
31023
|
-
}) => {
|
|
31024
|
-
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31025
|
-
clientId: clientId || "",
|
|
31026
|
-
branch: branch || "main",
|
|
31027
|
-
tokenStorage: "LOCAL_STORAGE",
|
|
31028
|
-
tinaioConfig,
|
|
31029
|
-
schema,
|
|
31030
|
-
tinaGraphQLVersion
|
|
31031
|
-
});
|
|
31032
|
-
};
|
|
31033
|
-
function assertShape(value, yupSchema, errorMessage) {
|
|
31034
|
-
const shape = yupSchema(yup);
|
|
31035
|
-
try {
|
|
31036
|
-
shape.validateSync(value);
|
|
31037
|
-
} catch (e) {
|
|
31038
|
-
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31039
|
-
throw new Error(message);
|
|
31040
|
-
}
|
|
31041
|
-
}
|
|
31042
|
-
function safeAssertShape(value, yupSchema) {
|
|
31043
|
-
try {
|
|
31044
|
-
assertShape(value, yupSchema);
|
|
31045
|
-
return true;
|
|
31046
|
-
} catch (e) {
|
|
31047
|
-
return false;
|
|
31048
|
-
}
|
|
31049
|
-
}
|
|
31050
31048
|
class TinaAdminApi {
|
|
31051
31049
|
constructor(cms) {
|
|
31052
31050
|
var _a, _b, _c, _d;
|
|
@@ -31393,6 +31391,56 @@ class TinaAdminApi {
|
|
|
31393
31391
|
);
|
|
31394
31392
|
}
|
|
31395
31393
|
}
|
|
31394
|
+
const createClient = ({
|
|
31395
|
+
clientId,
|
|
31396
|
+
isLocalClient = true,
|
|
31397
|
+
branch,
|
|
31398
|
+
tinaioConfig,
|
|
31399
|
+
schema,
|
|
31400
|
+
apiUrl,
|
|
31401
|
+
tinaGraphQLVersion
|
|
31402
|
+
}) => {
|
|
31403
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31404
|
+
clientId: clientId || "",
|
|
31405
|
+
branch: branch || "main",
|
|
31406
|
+
tokenStorage: "LOCAL_STORAGE",
|
|
31407
|
+
tinaioConfig,
|
|
31408
|
+
schema,
|
|
31409
|
+
tinaGraphQLVersion
|
|
31410
|
+
});
|
|
31411
|
+
};
|
|
31412
|
+
function assertShape(value, yupSchema, errorMessage) {
|
|
31413
|
+
const shape = yupSchema(yup);
|
|
31414
|
+
try {
|
|
31415
|
+
shape.validateSync(value);
|
|
31416
|
+
} catch (e) {
|
|
31417
|
+
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31418
|
+
throw new Error(message);
|
|
31419
|
+
}
|
|
31420
|
+
}
|
|
31421
|
+
function safeAssertShape(value, yupSchema) {
|
|
31422
|
+
try {
|
|
31423
|
+
assertShape(value, yupSchema);
|
|
31424
|
+
return true;
|
|
31425
|
+
} catch (e) {
|
|
31426
|
+
return false;
|
|
31427
|
+
}
|
|
31428
|
+
}
|
|
31429
|
+
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31430
|
+
const useTinaAuthRedirect = () => {
|
|
31431
|
+
useEffect(() => {
|
|
31432
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
31433
|
+
const config = {
|
|
31434
|
+
code: urlParams.get("code") || "",
|
|
31435
|
+
scope: urlParams.get("scope") || "email",
|
|
31436
|
+
state: urlParams.get("state")
|
|
31437
|
+
};
|
|
31438
|
+
if (!config.code) {
|
|
31439
|
+
return;
|
|
31440
|
+
}
|
|
31441
|
+
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31442
|
+
}, []);
|
|
31443
|
+
};
|
|
31396
31444
|
function sleep(ms) {
|
|
31397
31445
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31398
31446
|
}
|
|
@@ -31729,6 +31777,9 @@ const TinaCloudProvider = (props) => {
|
|
|
31729
31777
|
cms.flags.set("branch-switcher", true);
|
|
31730
31778
|
client.usingEditorialWorkflow = true;
|
|
31731
31779
|
client.protectedBranches = project.protectedBranches;
|
|
31780
|
+
if (!project.metadata[currentBranch]) {
|
|
31781
|
+
setCurrentBranch(project.defaultBranch || "main");
|
|
31782
|
+
}
|
|
31732
31783
|
}
|
|
31733
31784
|
});
|
|
31734
31785
|
};
|
|
@@ -31741,7 +31792,7 @@ const TinaCloudProvider = (props) => {
|
|
|
31741
31792
|
}
|
|
31742
31793
|
});
|
|
31743
31794
|
return unsubscribe;
|
|
31744
|
-
}, [isTinaCloud, cms]);
|
|
31795
|
+
}, [currentBranch, isTinaCloud, cms]);
|
|
31745
31796
|
return /* @__PURE__ */ React__default.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React__default.createElement(
|
|
31746
31797
|
BranchDataProvider,
|
|
31747
31798
|
{
|
|
@@ -33060,7 +33111,9 @@ const CollectionListPage = () => {
|
|
|
33060
33111
|
safeSubmit: async () => {
|
|
33061
33112
|
try {
|
|
33062
33113
|
await admin.deleteDocument(vars);
|
|
33063
|
-
cms.alerts.info(
|
|
33114
|
+
cms.alerts.info(
|
|
33115
|
+
"Document was successfully deleted"
|
|
33116
|
+
);
|
|
33064
33117
|
reFetchCollection();
|
|
33065
33118
|
} catch (error) {
|
|
33066
33119
|
cms.alerts.warn(
|
|
@@ -33089,7 +33142,9 @@ const CollectionListPage = () => {
|
|
|
33089
33142
|
relativePath: vars.relativePath,
|
|
33090
33143
|
newRelativePath
|
|
33091
33144
|
});
|
|
33092
|
-
cms.alerts.info(
|
|
33145
|
+
cms.alerts.info(
|
|
33146
|
+
"Document was successfully renamed"
|
|
33147
|
+
);
|
|
33093
33148
|
reFetchCollection();
|
|
33094
33149
|
} catch (error) {
|
|
33095
33150
|
if (error.message.indexOf("has references")) {
|
|
@@ -33189,7 +33244,9 @@ const CollectionListPage = () => {
|
|
|
33189
33244
|
name: "sort",
|
|
33190
33245
|
value: sortKey,
|
|
33191
33246
|
onChange: (e) => {
|
|
33192
|
-
const val = JSON.parse(
|
|
33247
|
+
const val = JSON.parse(
|
|
33248
|
+
e.target.value
|
|
33249
|
+
);
|
|
33193
33250
|
setEndCursor("");
|
|
33194
33251
|
setPrevCursors([]);
|
|
33195
33252
|
window == null ? void 0 : window.localStorage.setItem(
|
|
@@ -33978,7 +34035,10 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
33978
34035
|
const fetchDocument = async () => {
|
|
33979
34036
|
if (api.isAuthenticated()) {
|
|
33980
34037
|
try {
|
|
33981
|
-
const response = await api.fetchDocument(
|
|
34038
|
+
const response = await api.fetchDocument(
|
|
34039
|
+
collectionName,
|
|
34040
|
+
relativePath2
|
|
34041
|
+
);
|
|
33982
34042
|
setDocument(response.document);
|
|
33983
34043
|
} catch (error2) {
|
|
33984
34044
|
cms.alerts.error(
|