Browse Source

fixes in docs and comments

pull/4232/head
Alex Hoyau 4 years ago
parent
commit
7e2311085c
  1. 2
      CONTRIBUTING.md
  2. 2
      docs/api/block_manager.md
  3. 20
      src/utils/Droppable.js

2
CONTRIBUTING.md

@ -13,7 +13,7 @@ We welcome any type of contribution, not only code. Like for example:
## Your First Contribution ## Your First Contribution
Working on your first Pull Request? You can learn how from this **free** series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). Working on your first Pull Request? You can learn how from this **free** series, [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
## Submitting code ## Submitting code

2
docs/api/block_manager.md

@ -171,7 +171,7 @@ blockManager.render();
// Render new set of blocks // Render new set of blocks
const blocks = blockManager.getAll(); const blocks = blockManager.getAll();
const filtered = blocks.filter(block => block.get('category') == 'sections') const filtered = blocks.filter(block => block.get('category').id == 'Sections')
blockManager.render(filtered); blockManager.render(filtered);
// Or a new set from an array // Or a new set from an array

20
src/utils/Droppable.js

@ -17,13 +17,7 @@ export default class Droppable {
const els = Array.isArray(el) ? el : [el]; const els = Array.isArray(el) ? el : [el];
this.el = el; this.el = el;
this.counter = 0; this.counter = 0;
bindAll( bindAll(this, 'handleDragEnter', 'handleDragOver', 'handleDrop', 'handleDragLeave');
this,
'handleDragEnter',
'handleDragOver',
'handleDrop',
'handleDragLeave'
);
els.forEach(el => this.toggleEffects(el, 1)); els.forEach(el => this.toggleEffects(el, 1));
return this; return this;
@ -52,7 +46,7 @@ export default class Droppable {
}, },
customTarget({ event }) { customTarget({ event }) {
return doc.elementFromPoint(event.clientX, event.clientY); return doc.elementFromPoint(event.clientX, event.clientY);
} },
} }
: null; : null;
method(frameEl, 'pointerenter', this.handleDragEnter); method(frameEl, 'pointerenter', this.handleDragEnter);
@ -60,7 +54,7 @@ export default class Droppable {
method(document, 'pointerup', this.handleDrop); method(document, 'pointerup', this.handleDrop);
method(frameEl, 'pointerout', this.handleDragLeave); method(frameEl, 'pointerout', this.handleDragLeave);
// Test with touche devices (seems like frameEl is not capturing pointer events). // Test with touch devices (seems like frameEl is not capturing pointer events).
// on/off(document, 'pointermove', sorter.onMove); // for the sorter // on/off(document, 'pointermove', sorter.onMove); // for the sorter
// enable && this.handleDragEnter({}); // no way to use pointerenter/pointerout // enable && this.handleDragEnter({}); // no way to use pointerenter/pointerout
} }
@ -123,7 +117,7 @@ export default class Droppable {
} }
this.handleDragEnd(comp, dt); this.handleDragEnd(comp, dt);
target.remove(); target.remove();
} },
}); });
dragStop = cancel => dragger.stop(ev, { cancel }); dragStop = cancel => dragger.stop(ev, { cancel });
dragContent = cnt => (content = cnt); dragContent = cnt => (content = cnt);
@ -141,7 +135,7 @@ export default class Droppable {
pfx: 'gjs-', pfx: 'gjs-',
onEndMove: model => this.handleDragEnd(model, dt), onEndMove: model => this.handleDragEnd(model, dt),
document: this.el.ownerDocument, document: this.el.ownerDocument,
...(this.sortOpts || {}) ...(this.sortOpts || {}),
}); });
sorter.setDropContent(content); sorter.setDropContent(content);
sorter.startSort(); sorter.startSort();
@ -208,7 +202,7 @@ export default class Droppable {
content.push({ content.push({
type, type,
file, file,
attributes: { alt: file.name } attributes: { alt: file.name },
}); });
} }
} }
@ -220,7 +214,7 @@ export default class Droppable {
content = { content = {
type: 'link', type: 'link',
attributes: { href: content }, attributes: { href: content },
content: content content: content,
}; };
} else if (indexOf(types, 'text/json') >= 0) { } else if (indexOf(types, 'text/json') >= 0) {
const json = dt && dt.getData('text/json'); const json = dt && dt.getData('text/json');

Loading…
Cancel
Save