Skip to content

Commit 53897ef

Browse files
committed
#5306 passing the target dataset to the app worker
1 parent 94ceae6 commit 53897ef

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

apps/portal/view/learn/ContentTreeList.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class ContentTreeList extends TreeList {
235235

236236
storeData.push({id: i, name: line, sourceId: me.id});
237237

238-
contentArray[index] = `<h2 class="neo-h2" id="${me.id}__section__${i}">${line}</h2>`;
238+
contentArray[index] = `<h2 class="neo-h2" id="${me.id}__section__${i}" data-record-id="${i}">${line}</h2>`;
239239

240240
i++
241241
}

apps/portal/view/learn/ContentView.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ContentView extends Component {
6262
/**
6363
* @param {Object} data
6464
*/
65-
onClick(data) {console.log('click');
65+
onClick(data) {
6666
let me = this,
6767
record = me.record;
6868

apps/portal/view/learn/MainContainerController.mjs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,10 @@ class MainContainerController extends Controller {
152152
onIntersect(data) {
153153
console.log('onIntersect', data);
154154

155-
let me = this,
156-
panel = me.getReference('page-sections-panel'),
157-
list = panel.list,
158-
recordId = parseInt(data.targetId.split('__')[2]);
159-
160-
console.log(list.store);
161-
console.log(recordId)
155+
let me = this,
156+
panel = me.getReference('page-sections-panel'),
157+
list = panel.list,
158+
recordId = parseInt(data.data.recordId);
162159

163160
list.selectionModel.select(list.store.get(recordId));
164161
}

src/main/addon/IntersectionObserver.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@ class NeoIntersectionObserver extends Base {
3737

3838
if (entry.isIntersecting) {
3939
if (target.getBoundingClientRect().y < 200) {
40-
console.log(entry.target.id);
41-
console.log(entry.target.innerText);
40+
console.log(target.id);
41+
console.log(target.innerText);
4242
console.log(entry.isIntersecting);
43-
console.log(entry.target.getBoundingClientRect());
43+
console.log(target.getBoundingClientRect());
4444
console.log(entry);
4545
console.log(observer);
46+
console.log(target.dataset && {...target.dataset});
4647

47-
let path = DomEvents.getPathFromElement(entry.target).map(e => DomEvents.getTargetData(e));
48+
let data = target.dataset && {...target.dataset} || null,
49+
path = DomEvents.getPathFromElement(entry.target).map(e => DomEvents.getTargetData(e));
4850

4951
Neo.worker.Manager.sendMessage('app', {
5052
action : 'domEvent',
5153
eventName: 'intersect',
5254
data: {
55+
data,
5356
id : observer.rootId,
5457
isIntersecting: true,
5558
path,

0 commit comments

Comments
 (0)