-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-header.html
84 lines (64 loc) · 1.72 KB
/
content-header.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<link rel="import" href="content-behavior.html">
<dom-module id="content-header">
<style>
:host {
position: relative;
display:block;
width:100%;
}
:host h2{
border:var(--content-header-outline, 2px dashed transparent);
margin-left: var(--content-header-margin-left, -6px);
}
:host.active h2 {
border: var(--content-header-outline-active, 2px dashed #dadada);
}
:host.active h2:focus {
outline: none !important;
border: var(--content-header-outline-focus, 2px dashed #9E9E9E);
}
:host.hidden {
opacity:0;
transition: all 0.25s linear;
}
</style>
<template>
<h2 id="contentHeader">
<content></content>
</h2>
</template>
</dom-module>
<script>
Polymer({
is: 'content-header',
behaviors: [Elliptical.ComponentBehavior, Elliptical.ContentBehavior],
properties: {
},
listeners: {},
ready: function () {
this._contentReady();
if (this._isEditMode) this._setContentEditable();
},
_setContentEditable: function () {
this.classList.add('active');
this.$.contentHeader.setAttribute('contenteditable', true);
},
_resetContentEditable:function(){
this.classList.remove('active');
this.$.contentHeader.removeAttribute('contenteditable');
},
_onContentComponentShow: function () {
this._setContentEditable();
},
_onContentComponentHide: function () {
this._resetContentEditable();
},
_onContentComponentSet:function(content){
if(content) this.$.contentHeader.innerHTML=content;
this.classList.remove('hidden');
},
getContent:function(){
return this.$.contentHeader.innerHTML;
}
});
</script>