tinacms 0.0.0-d80714b-20241205222511 → 0.0.0-d9672bc-20250218033222

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/index.js CHANGED
@@ -3830,7 +3830,7 @@ flowchart TD
3830
3830
  function _objectWithoutProperties(source, excluded) {
3831
3831
  if (source == null)
3832
3832
  return {};
3833
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3833
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3834
3834
  var key, i;
3835
3835
  if (Object.getOwnPropertySymbols) {
3836
3836
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3845,7 +3845,7 @@ flowchart TD
3845
3845
  }
3846
3846
  return target;
3847
3847
  }
3848
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3848
+ function _objectWithoutPropertiesLoose(source, excluded) {
3849
3849
  if (source == null)
3850
3850
  return {};
3851
3851
  var target = {};
@@ -4935,7 +4935,28 @@ flowchart TD
4935
4935
  onChange,
4936
4936
  value,
4937
4937
  step
4938
- }) => /* @__PURE__ */ React__namespace.createElement(Input, { type: "number", step, value, onChange });
4938
+ }) => /* @__PURE__ */ React__namespace.createElement(
4939
+ Input,
4940
+ {
4941
+ type: "number",
4942
+ step,
4943
+ value,
4944
+ onChange: (event) => {
4945
+ const inputValue = event.target.value;
4946
+ const newValue = inputValue === "" ? void 0 : inputValue;
4947
+ if (onChange) {
4948
+ const syntheticEvent = {
4949
+ ...event,
4950
+ target: {
4951
+ ...event.target,
4952
+ value: newValue
4953
+ }
4954
+ };
4955
+ onChange(syntheticEvent);
4956
+ }
4957
+ }
4958
+ }
4959
+ );
4939
4960
  function useCMS() {
4940
4961
  return useCMS$1();
4941
4962
  }
@@ -5176,7 +5197,7 @@ flowchart TD
5176
5197
  side: "bottom",
5177
5198
  className: cn(
5178
5199
  "rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
5179
- "max-h-[30vh] max-w-[30vh] overflow-y-auto",
5200
+ "max-h-[30vh] max-w-[30vw] overflow-y-auto",
5180
5201
  className
5181
5202
  ),
5182
5203
  ...props
@@ -5268,11 +5289,7 @@ flowchart TD
5268
5289
  const node = nodes.find((node2) => node2.id === value);
5269
5290
  return node ? node._internalSys.filename : null;
5270
5291
  };
5271
- const ComboboxDemo = ({
5272
- cms,
5273
- input,
5274
- field
5275
- }) => {
5292
+ const Combobox = ({ cms, input, field }) => {
5276
5293
  const [open2, setOpen] = React__namespace.useState(false);
5277
5294
  const [value, setValue] = React__namespace.useState(input.value);
5278
5295
  const [displayText, setDisplayText] = React__namespace.useState(null);
@@ -5296,17 +5313,17 @@ flowchart TD
5296
5313
  if (loading === true) {
5297
5314
  return /* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
5298
5315
  }
5299
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
5316
+ return /* @__PURE__ */ React__namespace.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
5300
5317
  Button,
5301
5318
  {
5302
5319
  variant: "outline",
5303
5320
  role: "combobox",
5304
5321
  "aria-expanded": open2,
5305
- className: "w-52 justify-between"
5322
+ className: "w-full justify-between"
5306
5323
  },
5307
5324
  /* @__PURE__ */ React__namespace.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
5308
5325
  open2 ? /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropdown, { size: 20 })
5309
- )), /* @__PURE__ */ React__namespace.createElement(PopoverContent, { className: "p-0 relative" }, /* @__PURE__ */ React__namespace.createElement(
5326
+ )), /* @__PURE__ */ React__namespace.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React__namespace.createElement(
5310
5327
  Command,
5311
5328
  {
5312
5329
  shouldFilter: !field.experimental___filter,
@@ -5330,32 +5347,25 @@ flowchart TD
5330
5347
  }
5331
5348
  ),
5332
5349
  /* @__PURE__ */ React__namespace.createElement(CommandEmpty, null, "No reference found"),
5333
- /* @__PURE__ */ React__namespace.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React__namespace.createElement(
5334
- CommandGroup,
5335
- {
5336
- key: `${collection}-group`,
5337
- heading: collection
5338
- },
5339
- /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5340
- const { id, _values } = node;
5341
- return /* @__PURE__ */ React__namespace.createElement(
5342
- OptionComponent,
5343
- {
5344
- id,
5345
- key: id,
5346
- value,
5347
- field,
5348
- _values,
5349
- node,
5350
- onSelect: (currentValue) => {
5351
- setValue(currentValue);
5352
- setOpen(false);
5353
- }
5350
+ /* @__PURE__ */ React__namespace.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React__namespace.createElement(CommandGroup, { key: `${collection}-group`, heading: collection }, /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5351
+ const { id, _values } = node;
5352
+ return /* @__PURE__ */ React__namespace.createElement(
5353
+ OptionComponent,
5354
+ {
5355
+ id,
5356
+ key: id,
5357
+ value,
5358
+ field,
5359
+ _values,
5360
+ node,
5361
+ onSelect: (currentValue) => {
5362
+ setValue(currentValue);
5363
+ setOpen(false);
5354
5364
  }
5355
- );
5356
- }))
5357
- ))))
5358
- ))));
5365
+ }
5366
+ );
5367
+ }))))))
5368
+ )));
5359
5369
  };
5360
5370
  const useGetNode = (cms, id) => {
5361
5371
  const [document2, setDocument] = React__namespace.useState(
@@ -5428,7 +5438,7 @@ flowchart TD
5428
5438
  };
5429
5439
  const Reference = ({ input, field }) => {
5430
5440
  const cms = useCMS();
5431
- return /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__namespace.createElement(ComboboxDemo, { cms, input, field })), /* @__PURE__ */ React__namespace.createElement(ReferenceLink, { cms, input }));
5441
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__namespace.createElement(Combobox, { cms, input, field })), /* @__PURE__ */ React__namespace.createElement(ReferenceLink, { cms, input }));
5432
5442
  };
5433
5443
  const ButtonToggle = ({
5434
5444
  input,
@@ -7188,244 +7198,65 @@ flowchart TD
7188
7198
  str = "0" + str;
7189
7199
  return str;
7190
7200
  }
7191
- function _inheritsLoose(subClass, superClass) {
7192
- subClass.prototype = Object.create(superClass.prototype);
7193
- subClass.prototype.constructor = subClass;
7194
- _setPrototypeOf(subClass, superClass);
7195
- }
7196
- function _setPrototypeOf(o, p) {
7197
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7198
- o2.__proto__ = p2;
7199
- return o2;
7200
- };
7201
- return _setPrototypeOf(o, p);
7202
- }
7203
- function _objectWithoutPropertiesLoose(source, excluded) {
7204
- if (source == null)
7205
- return {};
7206
- var target = {};
7207
- var sourceKeys = Object.keys(source);
7208
- var key, i;
7209
- for (i = 0; i < sourceKeys.length; i++) {
7210
- key = sourceKeys[i];
7211
- if (excluded.indexOf(key) >= 0)
7212
- continue;
7213
- target[key] = source[key];
7214
- }
7215
- return target;
7216
- }
7217
- function _assertThisInitialized(self2) {
7218
- if (self2 === void 0) {
7219
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7220
- }
7221
- return self2;
7222
- }
7223
- function isNodeFound(current, componentNode, ignoreClass) {
7224
- if (current === componentNode) {
7225
- return true;
7226
- }
7227
- if (current.correspondingElement) {
7228
- return current.correspondingElement.classList.contains(ignoreClass);
7229
- }
7230
- return current.classList.contains(ignoreClass);
7231
- }
7232
- function findHighest(current, componentNode, ignoreClass) {
7233
- if (current === componentNode) {
7234
- return true;
7201
+ var useClickAway$1 = {};
7202
+ var util = {};
7203
+ Object.defineProperty(util, "__esModule", { value: true });
7204
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7205
+ var noop = function() {
7206
+ };
7207
+ util.noop = noop;
7208
+ function on(obj) {
7209
+ var args = [];
7210
+ for (var _i = 1; _i < arguments.length; _i++) {
7211
+ args[_i - 1] = arguments[_i];
7235
7212
  }
7236
- while (current.parentNode || current.host) {
7237
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7238
- return true;
7239
- }
7240
- current = current.parentNode || current.host;
7213
+ if (obj && obj.addEventListener) {
7214
+ obj.addEventListener.apply(obj, args);
7241
7215
  }
7242
- return current;
7243
7216
  }
7244
- function clickedScrollbar(evt) {
7245
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7246
- }
7247
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7248
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7249
- return;
7217
+ util.on = on;
7218
+ function off(obj) {
7219
+ var args = [];
7220
+ for (var _i = 1; _i < arguments.length; _i++) {
7221
+ args[_i - 1] = arguments[_i];
7250
7222
  }
7251
- var passive = false;
7252
- var options = Object.defineProperty({}, "passive", {
7253
- get: function get2() {
7254
- passive = true;
7255
- }
7256
- });
7257
- var noop = function noop2() {
7258
- };
7259
- window.addEventListener("testPassiveEventSupport", noop, options);
7260
- window.removeEventListener("testPassiveEventSupport", noop, options);
7261
- return passive;
7262
- };
7263
- function autoInc(seed) {
7264
- if (seed === void 0) {
7265
- seed = 0;
7223
+ if (obj && obj.removeEventListener) {
7224
+ obj.removeEventListener.apply(obj, args);
7266
7225
  }
7267
- return function() {
7268
- return ++seed;
7269
- };
7270
7226
  }
7271
- var uid = autoInc();
7272
- var passiveEventSupport;
7273
- var handlersMap = {};
7274
- var enabledInstances = {};
7275
- var touchEvents = ["touchstart", "touchmove"];
7276
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7277
- function getEventHandlerOptions(instance, eventName) {
7278
- var handlerOptions = {};
7279
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7280
- if (isTouchEvent && passiveEventSupport) {
7281
- handlerOptions.passive = !instance.props.preventDefault;
7282
- }
7283
- return handlerOptions;
7284
- }
7285
- function onClickOutsideHOC(WrappedComponent, config) {
7286
- var _class, _temp;
7287
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7288
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7289
- _inheritsLoose(onClickOutside, _Component);
7290
- function onClickOutside(props) {
7291
- var _this;
7292
- _this = _Component.call(this, props) || this;
7293
- _this.__outsideClickHandler = function(event) {
7294
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7295
- _this.__clickOutsideHandlerProp(event);
7296
- return;
7297
- }
7298
- var instance = _this.getInstance();
7299
- if (typeof instance.props.handleClickOutside === "function") {
7300
- instance.props.handleClickOutside(event);
7301
- return;
7302
- }
7303
- if (typeof instance.handleClickOutside === "function") {
7304
- instance.handleClickOutside(event);
7305
- return;
7306
- }
7307
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7308
- };
7309
- _this.__getComponentNode = function() {
7310
- var instance = _this.getInstance();
7311
- if (config && typeof config.setClickOutsideRef === "function") {
7312
- return config.setClickOutsideRef()(instance);
7313
- }
7314
- if (typeof instance.setClickOutsideRef === "function") {
7315
- return instance.setClickOutsideRef();
7316
- }
7317
- return reactDom.findDOMNode(instance);
7318
- };
7319
- _this.enableOnClickOutside = function() {
7320
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7321
- return;
7322
- }
7323
- if (typeof passiveEventSupport === "undefined") {
7324
- passiveEventSupport = testPassiveEventSupport();
7325
- }
7326
- enabledInstances[_this._uid] = true;
7327
- var events = _this.props.eventTypes;
7328
- if (!events.forEach) {
7329
- events = [events];
7330
- }
7331
- handlersMap[_this._uid] = function(event) {
7332
- if (_this.componentNode === null)
7333
- return;
7334
- if (_this.initTimeStamp > event.timeStamp)
7335
- return;
7336
- if (_this.props.preventDefault) {
7337
- event.preventDefault();
7338
- }
7339
- if (_this.props.stopPropagation) {
7340
- event.stopPropagation();
7341
- }
7342
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7343
- return;
7344
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7345
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7346
- return;
7347
- }
7348
- _this.__outsideClickHandler(event);
7349
- };
7350
- events.forEach(function(eventName) {
7351
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7352
- });
7353
- };
7354
- _this.disableOnClickOutside = function() {
7355
- delete enabledInstances[_this._uid];
7356
- var fn = handlersMap[_this._uid];
7357
- if (fn && typeof document !== "undefined") {
7358
- var events = _this.props.eventTypes;
7359
- if (!events.forEach) {
7360
- events = [events];
7361
- }
7362
- events.forEach(function(eventName) {
7363
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7364
- });
7365
- delete handlersMap[_this._uid];
7366
- }
7367
- };
7368
- _this.getRef = function(ref) {
7369
- return _this.instanceRef = ref;
7370
- };
7371
- _this._uid = uid();
7372
- _this.initTimeStamp = performance.now();
7373
- return _this;
7374
- }
7375
- var _proto = onClickOutside.prototype;
7376
- _proto.getInstance = function getInstance() {
7377
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7378
- return this;
7379
- }
7380
- var ref = this.instanceRef;
7381
- return ref.getInstance ? ref.getInstance() : ref;
7382
- };
7383
- _proto.componentDidMount = function componentDidMount() {
7384
- if (typeof document === "undefined" || !document.createElement) {
7385
- return;
7386
- }
7387
- var instance = this.getInstance();
7388
- if (config && typeof config.handleClickOutside === "function") {
7389
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7390
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7391
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7392
- }
7393
- }
7394
- this.componentNode = this.__getComponentNode();
7395
- if (this.props.disableOnClickOutside)
7396
- return;
7397
- this.enableOnClickOutside();
7398
- };
7399
- _proto.componentDidUpdate = function componentDidUpdate() {
7400
- this.componentNode = this.__getComponentNode();
7401
- };
7402
- _proto.componentWillUnmount = function componentWillUnmount() {
7403
- this.disableOnClickOutside();
7227
+ util.off = off;
7228
+ util.isBrowser = typeof window !== "undefined";
7229
+ util.isNavigator = typeof navigator !== "undefined";
7230
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7231
+ var react_1 = React;
7232
+ var util_1 = util;
7233
+ var defaultEvents = ["mousedown", "touchstart"];
7234
+ var useClickAway = function(ref, onClickAway, events) {
7235
+ if (events === void 0) {
7236
+ events = defaultEvents;
7237
+ }
7238
+ var savedCallback = react_1.useRef(onClickAway);
7239
+ react_1.useEffect(function() {
7240
+ savedCallback.current = onClickAway;
7241
+ }, [onClickAway]);
7242
+ react_1.useEffect(function() {
7243
+ var handler = function(event) {
7244
+ var el = ref.current;
7245
+ el && !el.contains(event.target) && savedCallback.current(event);
7404
7246
  };
7405
- _proto.render = function render() {
7406
- var _this$props = this.props;
7407
- _this$props.excludeScrollbar;
7408
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7409
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7410
- props.ref = this.getRef;
7411
- } else {
7412
- props.wrappedRef = this.getRef;
7247
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7248
+ var eventName = events_1[_i];
7249
+ util_1.on(document, eventName, handler);
7250
+ }
7251
+ return function() {
7252
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7253
+ var eventName2 = events_2[_i2];
7254
+ util_1.off(document, eventName2, handler);
7413
7255
  }
7414
- props.disableOnClickOutside = this.disableOnClickOutside;
7415
- props.enableOnClickOutside = this.enableOnClickOutside;
7416
- return React.createElement(WrappedComponent, props);
7417
7256
  };
7418
- return onClickOutside;
7419
- }(React.Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7420
- eventTypes: ["mousedown", "touchstart"],
7421
- excludeScrollbar: config && config.excludeScrollbar || false,
7422
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7423
- preventDefault: false,
7424
- stopPropagation: false
7425
- }, _class.getClass = function() {
7426
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7427
- }, _temp;
7428
- }
7257
+ }, [events, ref]);
7258
+ };
7259
+ var _default = useClickAway$1.default = useClickAway;
7429
7260
  const viewModes = {
7430
7261
  YEARS: "years",
7431
7262
  MONTHS: "months",
@@ -7954,22 +7785,13 @@ flowchart TD
7954
7785
  }
7955
7786
  con[method]("***react-datetime:" + message);
7956
7787
  }
7957
- class ClickOutBase extends React.Component {
7958
- constructor() {
7959
- super(...arguments);
7960
- __publicField(this, "container", React.createRef());
7961
- }
7962
- render() {
7963
- return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7964
- }
7965
- handleClickOutside(e) {
7966
- this.props.onClickOut(e);
7967
- }
7968
- setClickOutsideRef() {
7969
- return this.container.current;
7970
- }
7788
+ function ClickableWrapper({ className, onClickOut, children }) {
7789
+ const containerRef = React.useRef(null);
7790
+ _default(containerRef, (event) => {
7791
+ onClickOut(event);
7792
+ });
7793
+ return /* @__PURE__ */ React.createElement("div", { className, ref: containerRef }, children);
7971
7794
  }
7972
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7973
7795
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7974
7796
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7975
7797
  const format$1 = (val, _name, field) => {
@@ -8012,7 +7834,10 @@ flowchart TD
8012
7834
  ReactDateTimeWithStyles,
8013
7835
  {
8014
7836
  value: input.value,
8015
- onChange: input.onChange,
7837
+ onChange: (value) => {
7838
+ const newValue = value === "" ? void 0 : value;
7839
+ input.onChange(newValue);
7840
+ },
8016
7841
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8017
7842
  timeFormat: timeFormat || false,
8018
7843
  inputProps: { className: textFieldClasses },
@@ -9464,6 +9289,19 @@ flowchart TD
9464
9289
  }
9465
9290
  }
9466
9291
  }
9292
+ const encodeUrlIfNeeded = (url) => {
9293
+ if (url) {
9294
+ try {
9295
+ const parsed = new URL(url);
9296
+ parsed.pathname = parsed.pathname.split("/").filter((part) => part !== "").map(encodeURIComponent).join("/");
9297
+ return parsed.toString();
9298
+ } catch (e) {
9299
+ return url;
9300
+ }
9301
+ } else {
9302
+ return url;
9303
+ }
9304
+ };
9467
9305
  let MediaManager$1 = class MediaManager {
9468
9306
  constructor(store, events) {
9469
9307
  this.store = store;
@@ -9536,6 +9374,20 @@ flowchart TD
9536
9374
  try {
9537
9375
  this.events.dispatch({ type: "media:list:start", ...options });
9538
9376
  const media = await this.store.list(options);
9377
+ media.items = media.items.map((item) => {
9378
+ if (item.type === "dir") {
9379
+ return item;
9380
+ }
9381
+ if (item.thumbnails) {
9382
+ for (const [size, src] of Object.entries(item.thumbnails)) {
9383
+ item.thumbnails[size] = encodeUrlIfNeeded(src);
9384
+ }
9385
+ }
9386
+ return {
9387
+ ...item,
9388
+ src: encodeUrlIfNeeded(item.src)
9389
+ };
9390
+ });
9539
9391
  this.events.dispatch({ type: "media:list:success", ...options, media });
9540
9392
  return media;
9541
9393
  } catch (error) {
@@ -10343,7 +10195,7 @@ flowchart TD
10343
10195
  "Event Log"
10344
10196
  ));
10345
10197
  };
10346
- const version = "2.5.0";
10198
+ const version = "2.6.4";
10347
10199
  const Nav = ({
10348
10200
  isLocalMode,
10349
10201
  className = "",
@@ -14663,7 +14515,7 @@ flowchart TD
14663
14515
  key: template.name,
14664
14516
  onMouseDown: (e) => {
14665
14517
  e.preventDefault();
14666
- close();
14518
+ setOpen(false);
14667
14519
  insertMDX(editor, template);
14668
14520
  },
14669
14521
  className: ""
@@ -14749,7 +14601,12 @@ flowchart TD
14749
14601
  const [itemsShown, setItemsShown] = React.useState(11);
14750
14602
  const { overrides, templates } = useToolbarContext();
14751
14603
  const showEmbedButton = templates.length > 0;
14752
- let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14604
+ let items2 = [];
14605
+ if (Array.isArray(overrides)) {
14606
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14607
+ } else {
14608
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14609
+ }
14753
14610
  if (!showEmbedButton) {
14754
14611
  items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14755
14612
  }
@@ -15077,6 +14934,9 @@ flowchart TD
15077
14934
  if (typeof string !== "string") {
15078
14935
  return false;
15079
14936
  }
14937
+ if (string.startsWith("#")) {
14938
+ return true;
14939
+ }
15080
14940
  const generalMatch = string.match(protocolAndDomainRE);
15081
14941
  const emailLinkMatch = string.match(emailLintRE);
15082
14942
  const localUrlMatch = string.match(localUrlRE);
@@ -15098,12 +14958,12 @@ flowchart TD
15098
14958
  }
15099
14959
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15100
14960
  };
15101
- const RichEditor = (props) => {
14961
+ const RichEditor = ({ input, tinaForm, field }) => {
15102
14962
  var _a;
15103
14963
  const initialValue = React.useMemo(
15104
14964
  () => {
15105
14965
  var _a2, _b;
15106
- return ((_b = (_a2 = props.input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? props.input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
14966
+ return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
15107
14967
  },
15108
14968
  []
15109
14969
  );
@@ -15131,7 +14991,7 @@ flowchart TD
15131
14991
  ),
15132
14992
  []
15133
14993
  );
15134
- const tempId = [props.tinaForm.id, props.input.name].join(".");
14994
+ const tempId = [tinaForm.id, input.name].join(".");
15135
14995
  const id = React.useMemo(() => uuid() + tempId, [tempId]);
15136
14996
  const ref = React.useRef(null);
15137
14997
  React.useEffect(() => {
@@ -15141,13 +15001,13 @@ flowchart TD
15141
15001
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
15142
15002
  '[role="textbox"]'
15143
15003
  );
15144
- if (props.field.experimental_focusIntent && plateElement) {
15004
+ if (field.experimental_focusIntent && plateElement) {
15145
15005
  if (plateElement)
15146
15006
  plateElement.focus();
15147
15007
  }
15148
15008
  }, 100);
15149
15009
  }
15150
- }, [props.field.experimental_focusIntent, ref]);
15010
+ }, [field.experimental_focusIntent, ref]);
15151
15011
  return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
15152
15012
  plateCommon.Plate,
15153
15013
  {
@@ -15155,7 +15015,7 @@ flowchart TD
15155
15015
  initialValue,
15156
15016
  plugins: plugins$2,
15157
15017
  onChange: (value) => {
15158
- props.input.onChange({
15018
+ input.onChange({
15159
15019
  type: "root",
15160
15020
  children: value
15161
15021
  });
@@ -15164,12 +15024,12 @@ flowchart TD
15164
15024
  /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
15165
15025
  ToolbarProvider,
15166
15026
  {
15167
- tinaForm: props.tinaForm,
15168
- templates: props.field.templates,
15169
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15027
+ tinaForm,
15028
+ templates: field.templates,
15029
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
15170
15030
  },
15171
15031
  /* @__PURE__ */ React.createElement(FixedToolbar, null, /* @__PURE__ */ React.createElement(FixedToolbarButtons, null)),
15172
- /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null))
15032
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null)) : null
15173
15033
  ), /* @__PURE__ */ React.createElement(Editor, null))
15174
15034
  ));
15175
15035
  };
@@ -33249,15 +33109,24 @@ This will work when developing locally but NOT when deployed to production.
33249
33109
  }
33250
33110
  }
33251
33111
  if (state === "creatingPR") {
33252
- const foo = await tinaApi.createPullRequest({
33253
- baseBranch,
33254
- branch,
33255
- title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
33256
- });
33257
- console.log("PR created", foo);
33258
- cms.alerts.success("Pull request created.");
33259
- localStorage.setItem("tina.createBranchState", "done");
33260
- setState("done");
33112
+ try {
33113
+ const foo = await tinaApi.createPullRequest({
33114
+ baseBranch,
33115
+ branch,
33116
+ title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
33117
+ });
33118
+ console.log("PR created", foo);
33119
+ cms.alerts.success("Pull request created.");
33120
+ localStorage.setItem("tina.createBranchState", "done");
33121
+ setState("done");
33122
+ } catch (e) {
33123
+ console.error(e);
33124
+ cms.alerts.error("Failed to create PR");
33125
+ setErrorMessage(
33126
+ "Failed to create PR, please try again. If the problem persists please contact support."
33127
+ );
33128
+ setState("error");
33129
+ }
33261
33130
  }
33262
33131
  if (state === "done") {
33263
33132
  window.location.href = back;