Skip to content

Commit

Permalink
speaker note;npmignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ksky521 committed Jan 30, 2019
1 parent 3e38fe5 commit f40fc83
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/nodeppt-js/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__
__mocks__
10 changes: 10 additions & 0 deletions packages/nodeppt-js/assets/scss/modules/_note.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
text-align: left; // @include display-flex;
background: #fff;
}
&.show {
animation-duration: .8s;
animation-fill-mode: both;
animation-name: fadeInUp;
}
&.hide {
animation-duration: .8s;
animation-fill-mode: both;
animation-name: fadeOutDown;
}
}

section .note {
Expand Down
1 change: 0 additions & 1 deletion packages/nodeppt-js/plugins/echarts.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default class Echarts {
static onSectionEnter(event) {
const slide = event.detail.slide || {};
const {echartsNode, echartsInit, echartsData} = slide;
console.log(slide)
if (!echartsInit) {
setTimeout(() => {
const et = echarts.init(echartsNode, window.echartsTheme_);
Expand Down
36 changes: 36 additions & 0 deletions packages/nodeppt-js/plugins/speaker-note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import DOM from 'webslides/src/js/utils/dom';
import {default as Slide, Events as SlideEvents} from 'webslides/src/js/modules/slide';

export default class SpeakerNote {
constructor(wsInstance) {
this.ws_ = wsInstance;

const $note = DOM.toArray(this.ws_.el.querySelectorAll('.note'));

if ($note.length) {
$note.forEach((note, j) => {
const {i} = Slide.getSectionFromEl(note);
const slide = wsInstance.slides[i - 1];
slide.noteNode = note;
slide.el.addEventListener(SlideEvents.ENABLE, SpeakerNote.onSectionEnter);
slide.el.addEventListener(SlideEvents.DISABLE, SpeakerNote.onSectionDisabled);
});
}
}
static toggleNote(e) {
if (e.which === 110 && !event.metaKey && !event.ctrlKey && !event.shiftKey) {
// toggleNote
// console.log(this); // node
this.classList.toggle('show');
}
}
static onSectionDisabled(event) {
const $node = event.detail.slide.noteNode;
$node.removeEventListener('keypress', SpeakerNote.toggleNote.bind($node));
}
static onSectionEnter(event) {
const $node = event.detail.slide.noteNode;

$node.addEventListener('keypress', SpeakerNote.toggleNote.bind($node));
}
}
2 changes: 2 additions & 0 deletions packages/nodeppt-parser/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__
__mocks__
2 changes: 2 additions & 0 deletions packages/nodeppt-serve/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__
__mocks__
2 changes: 1 addition & 1 deletion packages/nodeppt-serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"file-loader": "3.0.1",
"friendly-errors-webpack-plugin": "1.7.0",
"html-loader": "0.5.5",
"html-webpack-plugin": "4.0.0-beta.3",
"html-webpack-plugin": "^4.0.0-beta.3",
"import-global": "^0.1.0",
"lodash.defaultsdeep": "^4.6.0",
"mini-css-extract-plugin": "0.5.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/nodeppt-shared-utils/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__
__mocks__
2 changes: 2 additions & 0 deletions packages/nodeppt/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__
__mocks__

0 comments on commit f40fc83

Please sign in to comment.