windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Contenteditable inside Polymer element

Asked By: Anonymous

I´m trying to make a custom polymer element be contenteditable. I´m a polymer newbie so I´m probably doing something stupid. I can create the element and it renders and reacts to events but it does not go into editable mode when clicked. Any ideas?

<polymer-element name="editable-h1">
  <template>
    <h1 contenteditable="true">
      <content></content>
    </h1>
  </template>
</polymer-element>

Example on codepen.io


Solution

Answered By: Anonymous

The elements declared within custom tag are considered part of the light DOM, and I’m guessing that, due to shadow boundaries, there is a problem with using contenteditable on them. You would need to reinsert the content nodes into the shadow root of your custom element to make this work.

Here is an example of how you can accomplish that:

Codepen

http://codepen.io/anon/pen/WbNWdw

Source

<html>
<head> 
<link rel="import" href="http://www.polymer-project.org/components/platform/platform.js">
<link rel="import" href="http://www.polymer-project.org/components/core-tooltip/core-tooltip.html">

<polymer-element name="editable-h1">
  <script>
  Polymer('editable-h1', {
    ready: function() {
        var sroot = this.$;
        var nodes = sroot.mycontent.getDistributedNodes();
        [].forEach.call(nodes, function(node) {
            sroot.editableportion.appendChild(node);
        });
    },
    blur: function () {
      console.log('blur');
    },
    click: function () {
      console.log('click');
    },
    focus: function () {
      console.log('focus');
    }
  });
  </script>
  <template>
    <h1 contenteditable="true" on-click="{{click}}" on-blur="{{blur}}" on-focus={{focus}} id="editableportion">
    </h1>
    <content id="mycontent"></content>
  </template>
</polymer-element>

</head>
  <body>
    <h1 contenteditable="true">I´m a regular heading</h1>    
    <editable-h1>
      I'm an polymer enhanced heading
      <span>With a span for good measure</span>
    </editable-h1> 
  </body> 
</html> 

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort http://www.kadinescort.net Gaziantep escort Denizli escort Adana escort Hatay escort Aydın escort İzmir escort Ankara escort Antalya escort Bursa escort İstanbul escort Kocaeli escort Konya escort Muğla escort Malatya escort Kayseri escort Mersin escort Samsun escort Sinop escort Tekirdağ escort Eskişehir escort Yalova escort Rize escort Amasya escort Balıkesir escort Çanakkale escort Bolu escort Erzincan escort Şırnak escort Van escort Yozgat escort Zonguldak escort Afyon escort Adıyaman escort Bilecik escort Aksaray escort Ağri escort Bitlis escort Siirt escort Çorum escort Burdur escort Diyarbakir escort Edirne escort Düzce escort Erzurum escort Kırklareli escort Giresun escort Kilis escort Kars escort Karabük escort Kırıkkale escort Mardin escort Kırşehir escort Maraş escort Manisa escort Muş escort Kastamonu escort Ordu escort Nevşehir escort Sakarya escort Osmaniye escort Şanliurfa escort Sivas escort Trabzon escort Tokat escort Ardahan escort Bartın escort Karaman escort Batman escort Bayburt escort Bingöl escort Elaziğ escort Gümüşhane escort Hakkari escort Isparta escort Uşak escort Igdır escort