Browse Source

fix echo poster

pull/2298/head
zhaoxin 6 years ago
parent
commit
7a2b465581
  1. 6
      index.html
  2. 4
      src/dom_components/model/ComponentVideo.js
  3. 5
      src/trait_manager/model/Trait.js
  4. 4
      src/trait_manager/view/TraitView.js

6
index.html

@ -16,6 +16,7 @@
<body> <body>
<div id="gjs" style="height:0px; overflow:hidden;"> <div id="gjs" style="height:0px; overflow:hidden;">
<video src="" poster="https://camo.githubusercontent.com/cf1a042fe34ab268410fdf6050699f20cf0aaef2/68747470733a2f2f796d6d2d6d616c69616e672e6f73732d636e2d68616e677a686f752e616c6979756e63732e636f6d2f796d6d2d6d616c69616e672f6163636573732f796d6d5f313533393538383635353835302e706e67"></video>
<div class="panel"> <div class="panel">
<h1 class="welcome">Welcome to</h1> <h1 class="welcome">Welcome to</h1>
<div class="big-title"> <div class="big-title">
@ -121,6 +122,11 @@
attributes: { class:'gjs-fonts gjs-f-b1' }, attributes: { class:'gjs-fonts gjs-f-b1' },
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>` content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>`
}) })
editor.BlockManager.add('Video', {
label: 'Video',
attributes: { class:'gjs-fonts gjs-f-b1' },
content: `<video />`
})
</script> </script>
</body> </body>
</html> </html>

4
src/dom_components/model/ComponentVideo.js

@ -182,8 +182,8 @@ export default Component.extend(
{ {
label: 'Poster', label: 'Poster',
name: 'poster', name: 'poster',
placeholder: 'eg. ./media/image.jpg', placeholder: 'eg. ./media/image.jpg'
changeProp: 1 // changeProp: 1
}, },
this.getAutoplayTrait(), this.getAutoplayTrait(),
this.getLoopTrait(), this.getLoopTrait(),

5
src/trait_manager/model/Trait.js

@ -67,11 +67,6 @@ export default Backbone.Model.extend({
if (this.get('changeProp')) { if (this.get('changeProp')) {
target.set(name, value, opts); target.set(name, value, opts);
if (name === 'poster') {
const attrs = { ...target.get('attributes') };
attrs[name] = value;
target.set('attributes', attrs, opts);
}
} else { } else {
const attrs = { ...target.get('attributes') }; const attrs = { ...target.get('attributes') };
attrs[name] = value; attrs[name] = value;

4
src/trait_manager/view/TraitView.js

@ -194,10 +194,6 @@ export default Backbone.View.extend({
if (model.get('changeProp')) { if (model.get('changeProp')) {
value = target.get(name); value = target.get(name);
if (name === 'poster') {
const attrs = target.get('attributes');
value = model.get('value') || attrs[name];
}
} else { } else {
const attrs = target.get('attributes'); const attrs = target.get('attributes');
value = model.get('value') || attrs[name]; value = model.get('value') || attrs[name];

Loading…
Cancel
Save