Skip to content

Commit

Permalink
Add tinymce4 demo and plugin source
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Craston committed Jun 8, 2015
1 parent 2d97679 commit ad3025f
Show file tree
Hide file tree
Showing 13 changed files with 757 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build
.DS_Store
.project
node_modules
.idea
148 changes: 148 additions & 0 deletions demo_tinymce4/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
body {
font-size: 16px;
line-height: 24px;
background: #EFEFEF;
height: 100%;
color: #6F6F6F;
font-family: Helvetica Neue,Helvetica,Arial;
}
div.container {
width: 720px;
margin: 0 auto;
}
.editor {
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 3px 0;
-moz-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 3px 0;
-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 3px 0;
margin-bottom: 30px;
padding: 10px;
width: 700px;
height: 455px;
}
h1, h3 {
color: #7F7F7F;
text-shadow: 0 1px 0 white;
}
.control { font: 12px Arial; padding: 5px; display: inline-block; margin-bottom: 5px; }
.control button { margin-right: 5px; }
#content { color: #333333; font: 14px; }
#content, #tinymce-wrapper { height: 300px; }
#text-wrapper {
width: 620px;
background: #CFCFCF;
min-height: 300px;
max-height: 300px;
overflow: auto;
padding: 40px;
border: 1px solid #BFBFBF;
font-size: 15px;
line-height: 24px;
}
#textbody {
margin: 0 auto;
border: solid 2px #BFBFBF;
background: white;
padding: 15px 30px 30px;
outline: none;
}
a.mceButton16 img.mceIcon { width: 16px; height: 16px; padding: 2px;}

.CT-hide .del, .CT-hide .del {
display: none;
}

.CT-hide .ins, .CT-hide .ins {
color: #333333;
background: none !important;
border: none !important;
text-decoration: none;
}

.del {
text-decoration: line-through;
}
.ins {
text-decoration: underline;
}

.cts-1 {
color: green;
}
.del.cts-1 img {
border-color: green;
}
.ins.cts-1 img {
background-color: green;
}
.cts-2 {
color: #C02000;
}
.del.cts-2 img {
border-color: #C02000;
}
.ins.cts-2 img {
background-color: #C02000;
}
.cts-3 {
color: #004090;
}
.del.cts-3 img {
border-color: #004090;
}
.ins.cts-3 img {
background-color: #004090;
}
.cts-4 {
color: #F06000;
}
.del.cts-4 img {
border-color: #F06000;
}
.ins.cts-4 img {
background-color: #F06000;
}
.cts-5 {
color: purple;
}
.del.cts-5 img {
border-color: purple;
}
.ins.cts-5 img {
background-color: purple;
}
.cts-6 {
color: #801080;
}
.del.cts-6 img {
border-color: #801080;
}
.ins.cts-6 img {
background-color: #801080;
}
.cts-7 {
color: #1080B0;
}
.del.cts-7 img {
border-color: #1080B0;
}
.ins.cts-7 img {
background-color: #1080B0;
}

.ice-avoid {
color: red;
}

.del img {
border-top-style: dotted;
border-bottom-style: dotted;
border-width: 4px;
}

.ins img {
padding: 3px;
}

.ins .del img {
padding: 0px 3px;
}
80 changes: 80 additions & 0 deletions demo_tinymce4/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE HTML>
<html>

<head>
<link rel="stylesheet" href="demo.css" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src='../lib/rangy/rangy-core.js'></script>
<script type="text/javascript" src='../src/polyfills.js'></script>
<script type="text/javascript" src='../src/ice.js'></script>
<script type="text/javascript" src='../src/dom.js'></script>
<script type="text/javascript" src='../src/icePlugin.js'></script>
<script type="text/javascript" src='../src/icePluginManager.js'></script>
<script type="text/javascript" src='../src/bookmark.js'></script>
<script type="text/javascript" src='../src/selection.js'></script>
<script type="text/javascript" src='../src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js'></script>
<script type="text/javascript" src='../src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js'></script>
<script type="text/javascript" src='../src/plugins/IceEmdashPlugin/IceEmdashPlugin.js'></script>
<script type="text/javascript" src='../src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js'></script>
<script src="http://tinymce.cachefly.net/4.1/tinymce.min.js"></script>
<script type="text/javascript" src="../tinymce4_plugin/plugin.js"></script>

</head>

<body>
<div class="container">

<h1>Ice Demo</h1>

<h3>Tinymce4 Plugin</h3>

<div class="editor">
<div class="control">
<strong>Set User:</strong>
<select onchange="setUserMCE(this)">
<option data-userid="11" data-username="Geoffrey Jellineck">Geoffrey Jellineck</option>
<option data-userid="22" data-username="Chuck Noblet">Chuck Noblet</option>
<option data-userid="33" data-username="Jerri Blank">Jerri Blank</option>
</select>
</div>
<div id="content">
<div id="tinymce-wrapper">
<textarea id="tinymce" style="width: 100%">
<p><span class="del cts-1" data-cid="2" data-userid="33" data-username="Jerri Blank" data-time="1326764311895" title="Deleted by Jerri Blank - 01/16/2012 8:38pm">Brooklyn</span><span class="ins cts-1" data-cid="3" data-userid="33" data-username="Jerri Blank" data-time="1326764319303" title="Inserted by Jerri Blank - 01/16/2012 8:38pm">Kings Point</span>, N.Y. &mdash; Adam Katz is happy to talk to reporters when he is promoting his business, a charter flight company based on Long Island called Talon Air.</p><p>But when the subject was his position as one of America's top earners, he <span class="del cts-1" data-cid="23" data-userid="33" data-username="Jerri Blank" data-time="1326765043953" title="Deleted by Jerri Blank - 01/16/2012 8:50pm">hesitated</span><span class="ins cts-1" data-cid="24" data-userid="33" data-username="Jerri Blank" data-time="1326765049283" title="Inserted by Jerri Blank - 01/16/2012 8:50pm">balked</span>. Seated at a desk fashioned from a jet fuel cell<span title="Inserted by Geoffrey Jellineck - 01/16/2012 8:42pm" data-time="1326764560331" data-username="Geoffrey Jellineck" data-userid="11" data-cid="20" class="ins cts-3">, wearing a button-down shirt with the company logo,</span> he considered the public relations benefits and found them lacking: "It's not very popular to be in the 1 percent these days, is it?"</p><p><span class="ins cts-2" data-cid="14" data-userid="22" data-username="Chuck Noblet" data-time="1326764402035" title="Inserted by Chuck Noblet - 01/16/2012 8:40pm">A few months ago, Mr. Katz was just a successful businessman with <span class="del cts-3" data-cid="15" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764492624" title="Deleted by Geoffrey Jellineck - 01/16/2012 8:41pm">four</span><span class="ins cts-3" data-cid="16" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764495239" title="Inserted by Geoffrey Jellineck - 01/16/2012 8:41pm">five</span> children, an $8 million home, a family real estate company in Manhattan and his passion, 10-year-old Talon Air.</span></p><p>Now, the colossal gap between the very rich and everyone else <span title="Inserted by Geoffrey Jellineck - 01/16/2012 8:46pm" data-time="1326764809499" data-username="Geoffrey Jellineck" data-userid="11" data-cid="22" class="ins cts-3">&mdash; the 1 percent versus the 99 percent &mdash; </span>has become a rallying point in this election season. As President Obama positions himself as a defender of the middle class, and Mitt Romney, the wealthiest of the Republican presidential candidates, decries such talk as "the bitter politics of envy," Mr. Katz has found himself on the wrong end of a new paradigm.</p><p><span class="ins cts-1" data-cid="30" data-userid="33" data-username="Jerri Blank" data-time="1326765098946" title="Inserted by Jerri Blank - 01/16/2012 8:51pm">As a member of the 1 percent, he is part of a club whose name conjures images of Wall Street bosses who are chauffeured from manse to Manhattan and fat cats who have armies of lobbyists at the ready.</span></p> <p>But in reality it is a far larger and more varied group, one that includes podiatrists and actuaries, executives and entrepreneurs, the self-made and the silver spoon set. They are clustered not just in New York and Los Angeles, but also in Denver and Dallas. The range of wealth in the 1 percent is vast &mdash; from households that bring in $380,000 a year, according to census data, up to billionaires like Warren E. Buffett and Bill Gates.</p><p>The top 1 percent of earners in a given year receives <a title="Related data from the Tax Policy Center." href="http://www.taxpolicycenter.org/numbers/displayatab.cfm?DocID=2972">just under a fifth</a> of the country's pretax income, <a title="A Congressional Budget Office report." href="http://www.cbo.gov/publications/collections/tax/2010/pre-tax_income_shares.pdf">about double their share</a> 30 years ago. They pay just over a fourth of all federal taxes, according to the Tax Policy Center. In 2007, they accounted for about 30 percent of philanthropic giving, according to Federal Reserve data. They received 22 percent of their income from capital gains, compared with 2 percent for everybody else.</p><p><span class="ins cts-3" data-cid="21" data-userid="11" data-username="Geoffrey Jellineck" data-time="1326764626633" title="Inserted by Geoffrey Jellineck - 01/16/2012 8:43pm">Still, they are not necessarily the idle rich. Mr. Katz, who sometimes commutes by amphibious plane and sometimes carries luggage for Talon Air passengers, likes to say he works "26/9."</span></p> <p>Most 1 percenters were born with socioeconomic advantages, which helps explain why the 1 percent is more likely than other Americans to have jobs, according to census data. They work longer hours, being three times more likely than the 99 percent to work more than 50 hours a week, and are more likely to be self-employed. Married 1 percenters are just as likely as other couples to have two incomes, but men are the big breadwinners, earning 75 percent of the money, compared with 64 percent of the income in other households.</p><p>Though many of the wealthy lean toward the Republican Party, in interviews, 1 percenters expressed a broad range of views on how to fix the economy. They think that President Obama is ruining it, or that Republicans in Congress have gone off the deep end. They favor a flat tax, or they believe the rich should pay a higher marginal rate. Some cheered on Occupy Wall Street, saying it was about time, while others wished the protesters would just get a job or take a bath. Still others were philosophical &mdash; perhaps because they could afford to be &mdash; viewing the <a href="http://topics.nytimes.com/top/reference/timestopics/subjects/r/recession_and_depression/index.html?inline=nyt-classifier" title="More articles about the recession." class="meta-classifier">recession</a> as something that would pass, like so many previous ups and downs.</p><p><span class="ins cts-2" data-cid="31" data-userid="22" data-username="Chuck Noblet" data-time="1326765165952" title="Inserted by Chuck Noblet - 01/16/2012 8:52pm">Of the 1 percenters interviewed for this article, almost all &amp;mdash; conservatives and liberals alike &amp;mdash; said the wealthy could and should shoulder more of the country's financial burden, and almost all said they viewed the current system as unfair. But they may prefer facing cuts to their own benefits like &lt;a href="http://topics.nytimes.com/top/reference/timestopics/subjects/s/social_security_us/index.html?inline=nyt-classifier" title="More articles about Social Security." class="meta-classifier"&gt;Social Security&lt;/a&gt; than paying more taxes. In &lt;a title="The survey, by the Russell Sage Foundation." href="http://www.russellsage.org/blog/r-mascarenhas/wealthiest-1-percent-and-common-good"&gt;one survey&lt;/a&gt; of wealthy Chicago families, almost twice as many respondents said they would cut government spending as those who said they would cut spending and raise revenue.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p>Even those who said the deck was stacked in their favor did not appreciate anti-rich rhetoric.</p><p>"I don't mind paying a little bit more in taxes. I don't mind putting money to programs that help the poor," said Anthony J. Bonomo of Manhasset, N.Y., who runs a medical malpractice insurance company and is a Republican. But, he said, he did mind taking a hit for the country's woes. "If those people could camp out in that park all day, why aren't they out looking for a job? Why are they blaming others?"</p><p>To many, 99 vs. 1 was an artificial distinction that overlooked hard work and moral character. "It shouldn't be relevant," said Mr. Katz , who said he both creates job and contributes to charitable causes. "I'm not hurting anyone. I'm helping a lot of people."</p><p><strong> The Enclave</strong></p><p>The placid sliver of Long Island that F. Scott Fitzgerald immortalized in "The Great Gatsby" as West Egg and East Egg seems almost to have shrugged off the recession.</p><p>A stretch of northwest Nassau County that includes Great Neck, Manhasset and Port Washington, this area has the country's highest concentration of 1 percenters, and one of the lowest unemployment rates in the state. Houses in Port Washington are worth only 10 percent less than they were at their peak, according to the <a href="http://topics.nytimes.com/top/reference/timestopics/subjects/s/standard_poors_caseshiller_home_price_index/index.html?inline=nyt-classifier" title="More articles about the Case-Shiller Home Price Index." class="meta-classifier">Standard &amp; Poor's Case-Shiller Home Price Index</a>, a far smaller decline than in the rest of the country. Yearly sales at the Americana Manhasset, the upscale granite and glass shopping center, have already exceeded their prerecession high. Even in down times, the 1 percent has <a title="Tables 1 and 2 in a related study (PDF). " href="http://www.treasury.gov/resource-center/tax-policy/Documents/incomemobilitystudy03-08revise.pdf">staying power</a>, being far more likely than any other group to stay where they are rather than slip to lower rungs of the economic ladder.</p>
</textarea>
</div>
</div>
</div>

<script type="text/javascript">

tinymce.init({
mode: "exact",
elements: "tinymce",
height: '400',
plugins: 'ice',
toolbar: 'ice_togglechanges ice_toggleshowchanges iceacceptall icerejectall iceaccept icereject',
ice: {
user: { name: 'Geoffrey Jellineck', id: 11},
titleDateFormat: 'd/m/Y h:ia',
mergeBlocks: false,
preserveOnPaste: 'p,a[href],i,em,b,span',
deleteTag: 'delete',
insertTag: 'insert'
},
extended_valid_elements: "insert,delete",
content_css: "../tinymce4_plugin/css/ice.css"
});

function setUserMCE(el) {
var name = $(el).find(':selected').data('username');
var id = $(el).find(':selected').data('userid');
tinymce.execCommand('ice_changeuser', {id: id, name: name});
}

</script>

</div>
</body>
</html>
27 changes: 27 additions & 0 deletions tinymce4_plugin/css/ice.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.CT-hide .del, .CT-hide .del {
display: none;
}

.CT-hide .ins, .CT-hide .ins {
color: #333333;
background: none !important;
border: none !important;
}

.ins,
.del {
-webkit-border-radius: 3px;
border-radius: 3px;
color: #ED1B2F;
padding: 1px 0 2px;
}

.ins {
background-color: #d1d3d4;
}

.del {
text-decoration: line-through;
color: #555;
background-color: #e8e8e8;
}
Binary file added tinymce4_plugin/img/accept.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-accept-change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-accept.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-reject-change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-reject.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-showchanges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/ice-togglechanges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinymce4_plugin/img/reject.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ad3025f

Please sign in to comment.