Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c: Repair Widget.groupId #79

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/src/content_types/notes/NotesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ var NotesManager = declare(AbstractContentManager, {
*/
groupHasRepresentative: function(groupId) {
for (let [uid, widget] of this.widgets) {
if (widget.groupId === groupId) {
if (widget.groupId() === groupId) {
return true;
}
}
Expand Down Expand Up @@ -909,7 +909,7 @@ var NotesManager = declare(AbstractContentManager, {
const LN = this.linkingMap;

const widget = this.widgets.get(uid);
const gid = widget.groupId;
const gid = widget.groupId();

const cm = this.hub.contentManager;
const clickedPane = pane;
Expand Down
7 changes: 7 additions & 0 deletions client/src/content_types/notes/SphinxViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ export class SphinxViewer extends BasePageViewer {
loc.scrollFrac = current.scrollFrac;
loc.scrollSel = current.scrollSel;
}
// By passing a location with a `url`, but without a `libpath` (or `version`),
// we can force a reload for pages that are already loaded. This will happen
// because, when control reaches our `pageContentsUpdateStep()` method, it will
// call `this.describeLocationUpdate()`, which will call it a "page change" on
// the grounds that the new location has a different `libpath` (namely none).
// In cases viewed as "page change," our `pageContentsUpdateStep()` method goes
// on to (re)load the iframe.
await super.reloadPage(loc);
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/widgets/ChartWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ const ChartWidget = declare(NavWidget, {
const over = info.hoverColor.over,
out = info.hoverColor.out;
wdq.on('mouseover', async () => {
const targetUuids = await nm.linkingMap.get(info.uuid, this.groupId);
const targetUuids = await nm.linkingMap.get(info.uuid, this.groupId());
for (const targetUuid of targetUuids) {
this.hub.contentManager.updateContentAnywhereByUuid(
{type: "CHART", color: over}, targetUuid, { selectPane: true });
}
});
wdq.on('mouseout', async () => {
const targetUuids = await nm.linkingMap.get(info.uuid, this.groupId);
const targetUuids = await nm.linkingMap.get(info.uuid, this.groupId());
for (const targetUuid of targetUuids) {
this.hub.contentManager.updateContentAnywhereByUuid(
{type: "CHART", color: out}, targetUuid, { selectPane: true });
Expand Down
8 changes: 5 additions & 3 deletions client/src/widgets/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ var Widget = declare(null, {
uid: null,
// the libpath of the page to which this widget belongs:
pagepath: null,
// the ID of the "widget group" (or "pane group") to which this widget belongs, if any:
groupId: null,
// the info object as originally passed:
origInfo: null,
// a "live" info object: starts as a copy of the one originally passed;
Expand All @@ -68,13 +66,17 @@ var Widget = declare(null, {
this.uid = info.uid;
this.pagepath = libpath.slice(0, libpath.lastIndexOf('.'));
this.modpath = libpath.slice(0, this.pagepath.lastIndexOf('.'));
this.groupId = info.pane_group;
this.origInfo = info;
this.liveInfo = this.getInfoCopy();
this.contextMenuByPaneId = new Map();
this.listeners = {};
},

// the ID of the "widget group" (or "pane group") to which this widget belongs, if any:
groupId: function() {
return this.origInfo?.pane_group;
},

getPagepathv: function() {
return `${this.pagepath}@${this.version}`
},
Expand Down
Loading