Using Polymer, I'm trying to create a component that re-uses markItUp so I can use a rich text editor whenever needed.
However, try as I might, I cannot get it to initialize correctly. The jQuery selector simply cannot find the textarea elements to perform its magic. I've tried numerous incantations with adding event listeners, responding to particular events, and most likely due to my lack of Javascript experience, I just cannot get it all to work together. Here's what I have so far (note that this file is in a folder under elements called "rich-textarea"):
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="stylesheet" type="text/css" href="../../bower_components/markitup-1x/markitup/skins/markitup/style.css">
<link rel="stylesheet" type="text/css" href="../../bower_components/markitup-1x/markitup/sets/default/style.css">
<script type="text/javascript" src="../../bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../../bower_components/markitup-1x/markitup/jquery.markitup.js"></script>
<script type="text/javascript" src="../../bower_components/markitup-1x/markitup/sets/default/set.js"></script>
<polymer-element name="rich-textarea" attributes="rows cols value">
<template>
<textarea class="makeItRich" rows="{{rows}" cols={{cols}}" value="{{value}}"></textarea>
</template>
<script>
Polymer('rich-textarea', {
value: "",
rows: 25,
cols: 80,
// here and below are where I need help
domReady: function() {
$(document).ready(function() {
$(".makeItRich").markItUp(mySettings);
});
}
});
</script>
</polymer-element>
Any assistance would be greatly appreciated. I see this question as a good litmus test on Polymer in general since it combines three technologies together. If this "just works", odds most anything will probably work going forward. Thanks for your time.