studiokit-scaffolding-js 7.0.8-alpha.2 → 7.0.8-alpha.4

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.
@@ -234,14 +234,22 @@ var CustomToolbar = function (props) {
234
234
  var guid = props.guid, sectionOptions = props.sectionOptions, moreSectionOptions = props.moreSectionOptions, className = props.className, disabled = props.disabled, reactQuillRef = props.reactQuillRef, isVisibleWhenDisabled = props.isVisibleWhenDisabled;
235
235
  var _a = react_1.useState(false), isInitialized = _a[0], setIsInitialized = _a[1];
236
236
  var _b = react_1.useState(false), isShowingMoreOptions = _b[0], setIsShowingMoreOptions = _b[1];
237
- var ref = react_1.default.createRef();
237
+ var toolbarRef = react_1.default.createRef();
238
238
  react_1.useEffect(function () {
239
- var _a;
240
- // initialize the toolbar after reactQuill exists and the buttons are displayed
241
- if (!isInitialized && reactQuillRef && (!disabled || isVisibleWhenDisabled)) {
242
- accessibilityFix_1.applyAccessibilityHacks(ref, reactQuillRef.getEditor());
239
+ console.log('CustomToolbar', {
240
+ isInitialized: isInitialized,
241
+ toolbarRef: toolbarRef,
242
+ toolbar: toolbarRef.current,
243
+ reactQuillRef: reactQuillRef,
244
+ editor: reactQuillRef === null || reactQuillRef === void 0 ? void 0 : reactQuillRef.getEditor(),
245
+ disabled: disabled,
246
+ isVisibleWhenDisabled: isVisibleWhenDisabled
247
+ });
248
+ // initialize the toolbar after toolbarRef and reactQuill editor exist and the buttons are displayed
249
+ if (!isInitialized && toolbarRef.current && reactQuillRef && (!disabled || isVisibleWhenDisabled)) {
250
+ accessibilityFix_1.applyAccessibilityHacks(toolbarRef, reactQuillRef.getEditor());
243
251
  // manually modify the table picker select svg icon
244
- var label = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('.ql-table .ql-picker-label');
252
+ var label = toolbarRef.current.querySelector('.ql-table .ql-picker-label');
245
253
  if (label) {
246
254
  var svg = label.childNodes[0];
247
255
  var polygons = svg.querySelectorAll('polygon');
@@ -259,11 +267,11 @@ var CustomToolbar = function (props) {
259
267
  }
260
268
  setIsInitialized(true);
261
269
  }
262
- }, [disabled, isInitialized, isVisibleWhenDisabled, reactQuillRef, ref]);
270
+ }, [disabled, isInitialized, isVisibleWhenDisabled, reactQuillRef, toolbarRef]);
263
271
  var toolbarSections = react_1.useMemo(function () { return getToolbarSectionsForOptions(sectionOptions); }, [sectionOptions]);
264
272
  var hasMoreOptions = !lodash_1.isUndefined(moreSectionOptions);
265
273
  var moreToolbarSections = react_1.useMemo(function () { return (!lodash_1.isUndefined(moreSectionOptions) ? getToolbarSectionsForOptions(moreSectionOptions) : []); }, [moreSectionOptions]);
266
- return (react_1.default.createElement("div", { id: "quill-toolbar-" + guid, className: "" + (className ? " " + className : '') + (disabled ? ' disabled' : '') + (!isVisibleWhenDisabled && disabled ? ' disabled-invisible' : ''), ref: ref }, (!disabled || isVisibleWhenDisabled) && (react_1.default.createElement(react_1.default.Fragment, null,
274
+ return (react_1.default.createElement("div", { id: "quill-toolbar-" + guid, className: "" + (className ? " " + className : '') + (disabled ? ' disabled' : '') + (!isVisibleWhenDisabled && disabled ? ' disabled-invisible' : ''), ref: toolbarRef }, (!disabled || isVisibleWhenDisabled) && (react_1.default.createElement(react_1.default.Fragment, null,
267
275
  toolbarSections.map(function (section, i) { return (react_1.default.createElement("span", { className: "ql-formats", key: i }, section(disabled))); }),
268
276
  hasMoreOptions && (react_1.default.createElement("button", { className: "more-options f6 fw5" + (isShowingMoreOptions ? ' expanded color-primary' : ''), type: "button", title: "More options", "aria-expanded": isShowingMoreOptions, onClick: function () { return setIsShowingMoreOptions(!isShowingMoreOptions); } },
269
277
  react_1.default.createElement(MoreHoriz_1.default, { className: "ma0" }))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "studiokit-scaffolding-js",
3
- "version": "7.0.8-alpha.2",
3
+ "version": "7.0.8-alpha.4",
4
4
  "description": "Common scaffolding for Studio apps at Purdue",
5
5
  "repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
6
6
  "license": "MIT",