How to use setContent method in Puppeteer

Best JavaScript code snippet using puppeteer

tinymce-button-old.js

Source:tinymce-button-old.js Github

copy

Full Screen

...123 ed.add({124 title: title,125 onclick: function() {126 if (id === '1/2') {127 tinyMCE.activeEditor.selection.setContent('[vc_column width="1/2"]Place Content Here[/vc_column]');128 }129 if (id === '1/3') {130 tinyMCE.activeEditor.selection.setContent('[vc_column width="1/3"]Place Content Here[/vc_column]');131 }132 if (id === '1/4') {133 tinyMCE.activeEditor.selection.setContent('[vc_column width="1/4"]Place Content Here[/vc_column]');134 }135 if (id === '1/6') {136 tinyMCE.activeEditor.selection.setContent('[vc_column width="1/6"]Place Content Here[/vc_column]');137 }138 if (id === '2/3') {139 tinyMCE.activeEditor.selection.setContent('[vc_column width="2/3"]Place Content Here[/vc_column]');140 }141 if (id === '3/4') {142 tinyMCE.activeEditor.selection.setContent('[vc_column width="3/4"]Place Content Here[/vc_column]');143 }144 if (id === '5/6') {145 tinyMCE.activeEditor.selection.setContent('[vc_column width="5/6"]Place Content Here[/vc_column]');146 }147 if (id === 'row') {148 tinyMCE.activeEditor.selection.setContent('[vc_row fullwidth="false"][vc_column width="1/1"]Place Content Here[/vc_column][/vc_row]');149 }150 if (id === 'page-section') {151 tinyMCE.activeEditor.selection.setContent('[mk_page_section attachment="scroll" bg_position="left top" bg_repeat="repeat" bg_stretch="false" enable_3d="false" speed_factor="4" bg_video="no" video_mask="false" video_opacity="0.6" top_shadow="false" section_layout="full" min_height="100" padding_top="10" padding_bottom="10" margin_bottom="0" first_page="false" last_page="false"][vc_column width="1/1"]Content Here[/vc_column][/mk_page_section]');152 }153 if (id === 'custom-box') {154 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_custom_box bg_color="#f6f6f6" bg_position="left top" bg_repeat="repeat" bg_stretch="false" padding_vertical="30" padding_horizental="20" margin_bottom="10" min_height="100"][/mk_custom_box][/vc_column][/vc_row]');155 }156 if (id === 'content-box') {157 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_content_box icon="moon-pushpin" heading="Title"][/mk_content_box][/vc_column][/vc_row]');158 }159 if (id === '1/2-1/2') {160 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/2"][/vc_column][vc_column width="1/2"][/vc_column][/vc_row]');161 }162 if (id === '1/3-1/3-1/3') {163 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/3"][/vc_column][vc_column width="1/3"][/vc_column][vc_column width="1/3"][/vc_column][/vc_row]');164 }165 if (id === '1/4-1/4-1/4-1/4') {166 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/4"][/vc_column][vc_column width="1/4"][/vc_column][vc_column width="1/4"][/vc_column][vc_column width="1/4"][/vc_column][/vc_row]');167 }168 if (id === '2/3-1/3') {169 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="2/3"][/vc_column][vc_column width="1/3"][/vc_column][/vc_row]');170 }171 if (id === '3/4-1/4') {172 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="3/4"][/vc_column][vc_column width="1/4"][/vc_column][/vc_row]');173 }174 if (id === '1/4-3/4') {175 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/4"][/vc_column][vc_column width="3/4"][/vc_column][/vc_row]');176 }177 if (id === '1/4-1/2-1/4') {178 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/4"][/vc_column][vc_column width="1/2"][/vc_column][vc_column width="1/4"][/vc_column][/vc_row]');179 }180 if (id === '1/6-2/3-1/6') {181 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/6"][/vc_column][vc_column width="2/3"][/vc_column][vc_column width="1/6"][/vc_column][/vc_row]');182 }183 if (id === '1/6-1/6-1/6-1/6-1/6-1/6') {184 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/6"][/vc_column][vc_column width="1/6"][/vc_column][vc_column width="1/6"][/vc_column][vc_column width="1/6"][/vc_column][vc_column width="1/6"][/vc_column][vc_column width="1/6"][/vc_column][/vc_row]');185 }186 if (id === 'divider') {187 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_divider style="double_dot" divider_width="full_width" margin_top="20" margin_bottom="20"][/vc_column][/vc_row]');188 }189 if (id === 'padding-divider') {190 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_padding_divider size="40"][/vc_column][/vc_row]');191 }192 if (id === 'clearboth') {193 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_clearboth][/vc_column][/vc_row]');194 }195 if (id === 'image') {196 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_image src="IMAGE_URL" image_width="800" image_height="350" crop="true" lightbox="false" frame_style="simple" target="_self" caption_location="inside-image" align="left" margin_bottom="10"][/vc_column][/vc_row]');197 }198 if (id === 'circle-frame-image') {199 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_circle_image src="IMAGE_URL" image_diameter="500" link="image_link"][/vc_column][/vc_row]');200 }201 if (id === 'moving-image') {202 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_moving_image src="IMAGE_URL" axis="vertical" align="left" title="alt text" link="link url"][/vc_column][/vc_row]');203 }204 if (id === 'image-gallery') {205 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_gallery images="6920,6918,6902,6896" column="3" height="500" frame_style="simple" disable_title="true"][/vc_column][/vc_row]');206 }207 if (id === 'fancy-title') {208 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_fancy_title tag_name="h2" style="true" color="#393836" size="14" font_weight="inhert" margin_top="0" margin_bottom="18" font_family="none" align="left"]Text Goes Here[/mk_fancy_title][/vc_column][/vc_row]');209 }210 if (id === 'title-box') {211 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_title_box color="#393836" highlight_color="#000000" highlight_opacity="0.3" size="18" line_height="34" font_weight="inherit" margin_top="0" margin_bottom="18" font_family="none" align="left"]Text Goes Here[/mk_title_box][/vc_column][/vc_row]');212 }213 if (id === 'text-block') {214 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_column_text disable_pattern="true" align="left" margin_bottom="0"]Text Goes Here[/vc_column_text][/vc_column][/vc_row]');215 }216 if (id === 'dropcaps') {217 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_dropcaps style="simple-style"]D[/mk_dropcaps][/vc_column][/vc_row]');218 }219 if (id === 'tooltip') {220 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_tooltip text="Text" tooltip_text="Tooltip Text" href="URL"][/vc_column][/vc_row]');221 }222 if (id === 'tabs') {223 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_tabs style="default" orientation="horizental" tab_location="left" container_bg_color="#fff"][vc_tab title="Tab 1" tab_id="1389303594-1-24"][/vc_tab][vc_tab title="Tab 2" tab_id="1389303594-2-84"][/vc_tab][/vc_tabs][/vc_column][/vc_row]');224 }225 if (id === 'accordion') {226 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_accordions style="fancy-style" action_style="accordion-action" open_toggle="0" container_bg_color="#fff"][vc_accordion_tab title="Section 1"][/vc_accordion_tab][vc_accordion_tab title="Section 2"][/vc_accordion_tab][/vc_accordions][/vc_column][/vc_row]');227 }228 if (id === 'toggle') {229 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_toggle title="Title" icon="moon-box-remove" style="simple"]content[/mk_toggle][/vc_column][/vc_row]');230 }231 if (id === 'blockquote') {232 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_blockquote style="quote-style" font_family="none" text_size="12" align="left"]Text[/mk_blockquote][/vc_column][/vc_row]');233 }234 if (id === 'highlight') {235 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_highlight text="Text" text_color="#ffffff" bg_color="#e5ff3d" font_family="none"][/vc_column][/vc_row]');236 }237 if (id === 'custom-list') {238 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_custom_list style="48" icon_color="#00c8d7" margin_bottom="30" align="none"]<ul><li>List Item</li><li>list Item</li></ul>[/mk_custom_list][/vc_column][/vc_row]');239 }240 if (id === 'font-icon') {241 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_font_icons icon="moon-droplet" color="#00a4db" size="x-large" padding_horizental="4" padding_vertical="4" circle="true" circle_color="#f5f5f5" align="none" link="URL"][/vc_column][/vc_row]');242 }243 if (id === 'icon-box') {244 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_icon_box title="Title" text_size="16" font_weight="inherit" read_more_txt="Read More Text" read_more_url="Read More URL" icon="moon-clock-7" style="simple_minimal" icon_size="small" rounded_circle="false" icon_location="left" circled="false" icon_color="#00c8d7" icon_circle_color="#00c8d7" box_blur="false" margin="30"]Box Content[/mk_icon_box][/vc_column][/vc_row]');245 }246 if (id === 'button') {247 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_button dimension="three" size="medium" outline_skin="dark" bg_color="#00c8d7" text_color="light" icon="moon-quill" url="Button URL" target="_self" align="left" id="Buton ID" margin_top="0" margin_bottom="15"]Button text[/mk_button][/vc_column][/vc_row]');248 }249 if (id === 'message-box') {250 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_message_box type="comment-message"]Content Goes Here[/mk_message_box][/vc_column][/vc_row]');251 }252 if (id === 'mini-callout') {253 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_mini_callout title="Title" button_text="Button text" button_url="Button URL"]Content[/mk_mini_callout][/vc_column][/vc_row]');254 }255 if (id === 'image-slideshow') {256 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_image_slideshow images="6920,6918,6902" image_width="770" image_height="350" effect="fade" animation_speed="700" slideshow_speed="7000" pause_on_hover="false" smooth_height="true" direction_nav="true"][/vc_column][/vc_row]');257 }258 if (id === 'full-width-slideshow') {259 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_fullwidth_slideshow border_color="#eaeaea" attachment="scroll" bg_position="left top" enable_3d="false" speed_factor="4" images="6893,6888" effect="fade" animation_speed="700" slideshow_speed="7000" pause_on_hover="false" smooth_height="true" direction_nav="true"][/vc_column][/vc_row]');260 }261 if (id === 'laptop-slideshow') {262 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_laptop_slideshow images="6984,6902,6896,6893,6888" size="full" animation_speed="700" slideshow_speed="7000" pause_on_hover="false"][/vc_column][/vc_row]');263 }264 if (id === 'lcd-slideshow') {265 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_lcd_slideshow images="6968,6956" animation_speed="700" slideshow_speed="7000" pause_on_hover="false"][/vc_column][/vc_row]');266 }267 if (id === 'flexslider') {268 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_flexslider count="10" slides="2729,2733,2734" order="ASC" orderby="menu_order" image_height="350" image_width="770" effect="fade" animation_speed="700" slideshow_speed="7000" pause_on_hover="false" smooth_height="true" direction_nav="true" caption_color="#ffffff" caption_bg_opacity="0.6"][/vc_column][/vc_row]');269 }270 if (id === 'layerslider') {271 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_layerslider id="4"][/vc_column][/vc_row]');272 }273 if (id === 'testimonial-slideshow') {274 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_testimonials title="Title" style="boxed" show_as="slideshow" column="3" skin="dark" count="10" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');275 }276 if (id === 'progress-bar') {277 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_skill_meter_chart title="Title" percent_1="0" color_1="#e74c3c" name_1="Skill 1 : Name" percent_2="0" color_2="#8c6645" name_2="Skill 2 : Name" percent_3="0" color_3="#265573" name_3="Skill 3 : Name" percent_4="0" color_4="#008b83" name_4="Skill 4 : Name" percent_5="0" color_5="#d96b52" name_5="Skill 5 : Name" percent_6="0" color_6="#82bf56" name_6="Skill 6 : Name" percent_7="0" color_7="#4ecdc4" name_7="Skill 7 : Name" default_text="Skill" center_color="#1e3641" default_text_color="#ffffff"][/vc_column][/vc_row]');278 }279 if (id === 'chart') {280 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_chart percent="50" bar_color="#00c8d7" track_color="#ececec" line_width="10" bar_size="150" content_type="percent" icon="moon-alarm-2"][/vc_column][/vc_row]');281 }282 if (id === 'skill-meter') {283 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_skill_meter title="Title" percent="50" color="#00c8d7"][/vc_column][/vc_row]');284 }285 if (id === 'pricing-table') {286 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_pricing_table style="multicolor" table_number="4" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');287 }288 if (id === 'table') {289 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_table title="Title" style="style1"]<table width="100%"><thead><tr><th>Column 1</th><th>Column 2</th><th>Column 3</th><th>Column 4</th></tr></thead><tbody><tr><td>Item #1</td><td>Description</td><td>Subtotal:</td><td>$3.00</td></tr><tr><td>Item #2</td><td>Description</td><td>Discount:</td><td>$4.00</td></tr><tr><td>Item #3</td><td>Description</td><td>Shipping:</td><td>$7.00</td></tr><tr><td>Item #4</td><td>Description</td><td>Tax:</td><td>$6.00</td></tr><tr><td><strong>All Items</strong></td><td><strong>Description</strong></td><td><strong>Your Total:</strong></td><td><strong>$20.00</strong></td></tr></tbody></table>[/mk_table][/vc_column][/vc_row]');290 }291 if (id === 'milestone') {292 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_milestone icon="moon-bell" icon_size="small" icon_color="#00c8d7" start="0" stop="100" speed="2000" prefix="Number Prefix" suffix="Number Suffix" text="Text Below Number" text_color="#999999"][/vc_column][/vc_row]');293 }294 if (id === 'event-countdown') {295 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_countdown year="2013" month="january" day="1" hour="1" minute="1"][/vc_column][/vc_row]');296 }297 if (id === 'blog') {298 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_blog style="modern" column="3" grid_image_height="350" count="10" offset="0" pagination="true" disable_meta="true" disable_lightbox="true" disable_comments_share="true" pagination_style="1" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');299 }300 if (id === 'blog-carousel') {301 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_blog_carousel view_all="*" count="10" enable_excerpt="false" offset="0" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');302 }303 if (id === 'blog-showcase') {304 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_blog_showcase offset="0" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');305 }306 if (id === 'portfolio') {307 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_portfolio style="classic" ajax="false" column="3" disable_excerpt="true" disable_permalink="true" count="10" sortable="true" offset="0" height="300" pagination="true" pagination_style="1" order="ASC" orderby="menu_order" target="_self"][/vc_column][/vc_row]');308 }309 if (id === 'portfolio-carousel') {310 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_portfolio_carousel style="classic" view_all="*" count="10" show_items="4" offset="0" disable_title_cat="true" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');311 }312 if (id === 'news') {313 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_news count="10" offset="0" image_height="250" pagination="true" pagination_style="2" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');314 }315 if (id === 'newstab') {316 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_news_tab tab_title="News"][/vc_column][/vc_row]');317 }318 if (id === 'faq') {319 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_faq style="fancy" sortable="true" count="50" offset="0" order="DESC" orderby="menu_order"][/vc_column][/vc_row]');320 }321 if (id === 'employees') {322 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_employees style="simple" column="3" rounded_image="true" box_blur="false" count="10" offset="0" description="true" order="ASC" orderby="menu_order"][/vc_column][/vc_row]');323 }324 if (id === 'clients') {325 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_clients count="10" order="ASC" orderby="menu_order" height="110" autoplay="true" target="_self"][/vc_column][/vc_row]');326 }327 if (id === 'twitter-feeds') {328 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_twitter twitter_name="Twitter name" tweets_count="5"][/vc_column][/vc_row]');329 }330 if (id === 'flickr') {331 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_flickr flickr_id="Flickr ID" count="6" thumb_size="s" type="user" display="latest"][/vc_column][/vc_row]');332 }333 if (id === 'facebook-like') {334 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_facebook type="standard"][/vc_column][/vc_row]');335 }336 if (id === 'tweetme') {337 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_tweetme type="horizontal"][/vc_column][/vc_row]');338 }339 if (id === 'googleplus') {340 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_googleplus annotation="inline"][/vc_column][/vc_row]');341 }342 if (id === 'pinterest') {343 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_pinterest][/vc_column][/vc_row]');344 }345 if (id === 'social-networks') {346 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_social_networks size="small" style="rounded" margin="4" icon_color="#cccccc" align="left" facebook="#" twitter="#" rss="#" dribbble="#" digg="#" pinterest="#" flickr="#" google_plus="#" linkedin="#" blogger="#" youtube="#" last_fm="#" stumble_upon="#" tumblr="#" vimeo="#" wordpress="#" yelp="#" reddit="#" xing="#"][/vc_column][/vc_row]');347 }348 if (id === 'skype') {349 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_skype display_number="Your Skype Number (Display)" number="Your Skype Number (exact number)"][/vc_column][/vc_row]');350 }351 if (id === 'contact-form') {352 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_contact_form style="modern" skin="dark" email="#"][/vc_column][/vc_row]');353 }354 if (id === 'contact-info') {355 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_contact_info title="#" phone="#" fax="#" email="#" address="#" person="#" company="#" skype="#" website="#"][/vc_column][/vc_row]');356 }357 if (id === 'video-player') {358 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_video title="#" link="#"][/vc_column][/vc_row]');359 }360 if (id === 'audio-player') {361 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][mk_audio mp3_file="#" ogg_file="#" thumb="#" audio_author="#"][/vc_column][/vc_row]');362 }363 if (id === 'google-maps') {364 tinyMCE.activeEditor.selection.setContent('[vc_row][vc_column width="1/1"][vc_gmaps title="#" link="#" size="300" type="m" zoom="14" frame_style="simple"][/vc_column][/vc_row]');365 }366 if (id === 'advanced-gmaps') {367 tinyMCE.activeEditor.selection.setContent('');368 }369 return false;370 }371 });372 }373 });374 tinymce.PluginManager.add('mk_shortcodes', tinymce.plugins.mkShortcodeMce);...

Full Screen

Full Screen

FormattingCommandsTest.js

Source:FormattingCommandsTest.js Github

copy

Full Screen

...14 var ok = function (value, label) {15 return LegacyUnit.equal(value, true, label);16 };17 suite.test('Justify - multiple block elements selected - queryCommandState', function (editor) {18 editor.setContent(19 '<div style="text-align: left;"><div id="a" style="text-align: right;">' +20 'one</div><div id="b" style="text-align: right;">two</div></div>'21 );22 LegacyUnit.setSelection(editor, '#a', 0, '#b', 3);23 LegacyUnit.equal(editor.queryCommandState('JustifyLeft'), false);24 ok(editor.queryCommandState('JustifyRight'));25 });26 suite.test('Formatting commands (xhtmlTextStyles)', function (editor) {27 editor.focus();28 editor.setContent('test 123');29 editor.execCommand('SelectAll');30 editor.execCommand('Bold');31 LegacyUnit.equal(editor.getContent(), "<p><strong>test 123</strong></p>");32 editor.setContent('test 123');33 editor.execCommand('SelectAll');34 editor.execCommand('Italic');35 LegacyUnit.equal(editor.getContent(), "<p><em>test 123</em></p>");36 editor.setContent('test 123');37 editor.execCommand('SelectAll');38 editor.execCommand('Underline');39 LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');40 editor.setContent('test 123');41 editor.execCommand('SelectAll');42 editor.execCommand('Strikethrough');43 LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');44 editor.setContent('test 123');45 editor.execCommand('SelectAll');46 editor.execCommand('FontName', false, 'Arial');47 LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');48 editor.setContent('test 123');49 editor.execCommand('SelectAll');50 editor.execCommand('FontSize', false, '7');51 LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');52 editor.setContent('test 123');53 editor.execCommand('SelectAll');54 editor.execCommand('ForeColor', false, '#FF0000');55 LegacyUnit.equal(editor.getContent(), '<p><span style="color: #ff0000;">test 123</span></p>');56 editor.setContent('test 123');57 editor.execCommand('SelectAll');58 editor.execCommand('HiliteColor', false, '#FF0000');59 LegacyUnit.equal(editor.getContent(), '<p><span style="background-color: #ff0000;">test 123</span></p>');60 editor.setContent('<p><span style="text-decoration: underline;">test 123</span></p>');61 LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');62 editor.setContent('<p><span style="text-decoration: line-through;">test 123</span></p>');63 LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');64 editor.setContent('<p><span style="font-family: Arial;">test 123</span></p>');65 LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');66 editor.setContent('<p><span style="font-size: xx-large;">test 123</span></p>');67 LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');68 editor.setContent('<p><strike>test 123</strike></p>');69 LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');70 editor.setContent('<p><font face="Arial">test 123</font></p>');71 LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');72 editor.setContent('<p><font size="7">test 123</font></p>');73 LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: 300%;">test 123</span></p>');74 editor.setContent('<p><font face="Arial" size="7">test 123</font></p>');75 LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: 300%; font-family: Arial;">test 123</span></p>');76 editor.setContent('<font style="background-color: #ff0000" color="#ff0000">test</font><font face="Arial">test</font>');77 LegacyUnit.equal(78 editor.getContent(),79 '<p><span style="color: #ff0000; background-color: #ff0000;">test</span><span style="font-family: Arial;">test</span></p>'80 );81 editor.setContent('<p><font face="Arial" style="color: #ff0000">test 123</font></p>');82 LegacyUnit.equal(editor.getContent(), '<p><span style="color: #ff0000; font-family: Arial;">test 123</span></p>');83 });84 suite.test('Formatting commands (alignInline)', function (editor) {85 editor.setContent('<p>test 123</p>');86 editor.execCommand('SelectAll');87 editor.execCommand('JustifyLeft');88 LegacyUnit.equal(editor.getContent(), '<p style="text-align: left;">test 123</p>');89 editor.setContent('<p>test 123</p>');90 editor.execCommand('SelectAll');91 editor.execCommand('JustifyCenter');92 LegacyUnit.equal(editor.getContent(), '<p style="text-align: center;">test 123</p>');93 editor.setContent('<p>test 123</p>');94 editor.execCommand('SelectAll');95 editor.execCommand('JustifyRight');96 LegacyUnit.equal(editor.getContent(), '<p style="text-align: right;">test 123</p>');97 editor.setContent('<p>test 123</p>');98 editor.execCommand('SelectAll');99 editor.execCommand('JustifyFull');100 LegacyUnit.equal(editor.getContent(), '<p style="text-align: justify;">test 123</p>');101 editor.setContent('<img src="tinymce/ui/img/raster.gif" />');102 editor.selection.select(editor.dom.select('img')[0]);103 editor.execCommand('JustifyLeft');104 LegacyUnit.equal(editor.getContent(), '<p><img style="float: left;" src="tinymce/ui/img/raster.gif" /></p>');105 editor.setContent('<img src="tinymce/ui/img/raster.gif" />');106 editor.selection.select(editor.dom.select('img')[0]);107 editor.execCommand('JustifyCenter');108 LegacyUnit.equal(109 editor.getContent(),110 '<p><img style="margin-right: auto; margin-left: auto; display: block;" src="tinymce/ui/img/raster.gif" /></p>'111 );112 editor.setContent('<img src="tinymce/ui/img/raster.gif" />');113 editor.selection.select(editor.dom.select('img')[0]);114 editor.execCommand('JustifyRight');115 LegacyUnit.equal(editor.getContent(), '<p><img style="float: right;" src="tinymce/ui/img/raster.gif" /></p>');116 });117 suite.test('mceBlockQuote', function (editor) {118 editor.focus();119 editor.setContent('<p>test 123</p>');120 editor.execCommand('SelectAll');121 editor.execCommand('mceBlockQuote');122 LegacyUnit.equal(editor.getContent().replace(/\s+/g, ''), '<blockquote><p>test123</p></blockquote>');123 editor.setContent('<p>test 123</p><p>test 123</p>');124 editor.execCommand('SelectAll');125 editor.execCommand('mceBlockQuote');126 LegacyUnit.equal(editor.getContent().replace(/\s+/g, ''), '<blockquote><p>test123</p><p>test123</p></blockquote>');127 });128 suite.test('FormatBlock', function (editor) {129 editor.setContent('<p>test 123</p>');130 editor.execCommand('SelectAll');131 editor.execCommand('FormatBlock', false, 'h1');132 LegacyUnit.equal(editor.getContent(), '<h1>test 123</h1>');133 editor.execCommand('SelectAll');134 editor.execCommand('FormatBlock', false, 'h2');135 LegacyUnit.equal(editor.getContent(), '<h2>test 123</h2>');136 editor.execCommand('SelectAll');137 editor.execCommand('FormatBlock', false, 'h3');138 LegacyUnit.equal(editor.getContent(), '<h3>test 123</h3>');139 editor.execCommand('SelectAll');140 editor.execCommand('FormatBlock', false, 'h4');141 LegacyUnit.equal(editor.getContent(), '<h4>test 123</h4>');142 editor.execCommand('SelectAll');143 editor.execCommand('FormatBlock', false, 'h5');144 LegacyUnit.equal(editor.getContent(), '<h5>test 123</h5>');145 editor.execCommand('SelectAll');146 editor.execCommand('FormatBlock', false, 'h6');147 LegacyUnit.equal(editor.getContent(), '<h6>test 123</h6>');148 editor.execCommand('SelectAll');149 try {150 editor.execCommand('FormatBlock', false, 'div');151 } catch (ex) {152 //t.log('Failed: ' + ex.message);153 }154 LegacyUnit.equal(editor.getContent(), '<div>test 123</div>');155 editor.execCommand('SelectAll');156 editor.execCommand('FormatBlock', false, 'address');157 LegacyUnit.equal(editor.getContent(), '<address>test 123</address>');158 editor.execCommand('SelectAll');159 editor.execCommand('FormatBlock', false, 'pre');160 LegacyUnit.equal(editor.getContent(), '<pre>test 123</pre>');161 });162 suite.test('mceInsertLink (relative)', function (editor) {163 editor.setContent('test 123');164 editor.execCommand('SelectAll');165 editor.execCommand('mceInsertLink', false, 'test');166 LegacyUnit.equal(editor.getContent(), '<p><a href="test">test 123</a></p>');167 });168 suite.test('mceInsertLink (link absolute)', function (editor) {169 editor.setContent('<p>test 123</p>');170 editor.execCommand('SelectAll');171 editor.execCommand('mceInsertLink', false, 'http://www.site.com');172 LegacyUnit.equal(editor.getContent(), '<p><a href="http://www.site.com">test 123</a></p>');173 });174 suite.test('mceInsertLink (link encoded)', function (editor) {175 editor.setContent('<p>test 123</p>');176 editor.execCommand('SelectAll');177 editor.execCommand('mceInsertLink', false, '"&<>');178 LegacyUnit.equal(editor.getContent(), '<p><a href="&quot;&amp;&lt;&gt;">test 123</a></p>');179 });180 suite.test('mceInsertLink (link encoded and with class)', function (editor) {181 editor.setContent('<p>test 123</p>');182 editor.execCommand('SelectAll');183 editor.execCommand('mceInsertLink', false, { href: '"&<>', 'class': 'test' });184 LegacyUnit.equal(editor.getContent(), '<p><a class="test" href="&quot;&amp;&lt;&gt;">test 123</a></p>');185 });186 suite.test('mceInsertLink (link with space)', function (editor) {187 editor.setContent('<p>test 123</p>');188 editor.execCommand('SelectAll');189 editor.execCommand('mceInsertLink', false, { href: 'foo bar' });190 LegacyUnit.equal(editor.getContent(), '<p><a href="foo%20bar">test 123</a></p>');191 });192 suite.test('mceInsertLink (link floated img)', function (editor) {193 editor.setContent('<p><img style="float: right;" src="about:blank" /></p>');194 editor.execCommand('SelectAll');195 editor.execCommand('mceInsertLink', false, 'link');196 LegacyUnit.equal(editor.getContent(), '<p><a href="link"><img style="float: right;" src="about:blank" /></a></p>');197 });198 suite.test('mceInsertLink (link adjacent text)', function (editor) {199 var rng;200 editor.setContent('<p><a href="#">a</a>b</p>');201 rng = editor.dom.createRng();202 rng.setStart(editor.getBody().firstChild.lastChild, 0);203 rng.setEnd(editor.getBody().firstChild.lastChild, 1);204 editor.selection.setRng(rng);205 editor.execCommand('mceInsertLink', false, 'link');206 LegacyUnit.equal(editor.getContent(), '<p><a href="#">a</a><a href="link">b</a></p>');207 });208 suite.test('mceInsertLink (link text inside text)', function (editor) {209 editor.setContent('<p><a href="#"><em>abc</em></a></p>');210 LegacyUnit.setSelection(editor, 'em', 1, 'em', 2);211 editor.execCommand('mceInsertLink', false, 'link');212 LegacyUnit.equal(editor.getContent(), '<p><a href="link"><em>abc</em></a></p>');213 });214 suite.test('mceInsertLink (link around existing links)', function (editor) {215 editor.setContent('<p><a href="#1">1</a><a href="#2">2</a></p>');216 editor.execCommand('SelectAll');217 editor.execCommand('mceInsertLink', false, 'link');218 LegacyUnit.equal(editor.getContent(), '<p><a href="link">12</a></p>');219 });220 suite.test('mceInsertLink (link around existing links with different attrs)', function (editor) {221 editor.setContent('<p><a id="a" href="#1">1</a><a id="b" href="#2">2</a></p>');222 editor.execCommand('SelectAll');223 editor.execCommand('mceInsertLink', false, 'link');224 LegacyUnit.equal(editor.getContent(), '<p><a href="link">12</a></p>');225 });226 suite.test('mceInsertLink (link around existing complex contents with links)', function (editor) {227 editor.setContent(228 '<p><span id="s1"><strong><a id="a" href="#1"><em>1</em></a></strong></span><span id="s2">' +229 '<em><a id="b" href="#2"><strong>2</strong></a></em></span></p>'230 );231 editor.execCommand('SelectAll');232 editor.execCommand('mceInsertLink', false, 'link');233 LegacyUnit.equal(234 editor.getContent(),235 '<p><a href="link"><span id="s1"><strong><em>1</em>' +236 '</strong></span><span id="s2"><em><strong>2</strong></em></span></a></p>'237 );238 });239 suite.test('mceInsertLink (link text inside link)', function (editor) {240 editor.setContent('<p><a href="#">test</a></p>');241 LegacyUnit.setSelection(editor, 'p', 0, 'p', 1);242 editor.execCommand('SelectAll');243 editor.execCommand('mceInsertLink', false, 'link');244 LegacyUnit.equal(editor.getContent(), '<p><a href="link">test</a></p>');245 });246 suite.test('mceInsertLink bug #7331', function (editor) {247 editor.setContent('<table><tbody><tr><td>A</td></tr><tr><td>B</td></tr></tbody></table>');248 var rng = editor.dom.createRng();249 rng.setStart(editor.$('td')[1].firstChild, 0);250 rng.setEnd(editor.getBody(), 1);251 editor.selection.setRng(rng);252 editor.execCommand('mceInsertLink', false, { href: 'x' });253 LegacyUnit.equal(editor.getContent(), '<table><tbody><tr><td>A</td></tr><tr><td><a href=\"x\">B</a></td></tr></tbody></table>');254 });255 suite.test('unlink', function (editor) {256 editor.setContent('<p><a href="test">test</a> <a href="test">123</a></p>');257 editor.execCommand('SelectAll');258 editor.execCommand('unlink');259 LegacyUnit.equal(editor.getContent(), '<p>test 123</p>');260 });261 suite.test('unlink - unselected a[href] with childNodes', function (editor) {262 editor.setContent('<p><a href="test"><strong><em>test</em></strong></a></p>');263 LegacyUnit.setSelection(editor, 'em', 0);264 editor.execCommand('unlink');265 LegacyUnit.equal(editor.getContent(), '<p><strong><em>test</em></strong></p>');266 });267 suite.test('subscript/superscript', function (editor) {268 editor.setContent('<p>test 123</p>');269 editor.execCommand('SelectAll');270 editor.execCommand('subscript');271 LegacyUnit.equal(editor.getContent(), '<p><sub>test 123</sub></p>');272 editor.setContent('<p>test 123</p>');273 editor.execCommand('SelectAll');274 editor.execCommand('superscript');275 LegacyUnit.equal(editor.getContent(), '<p><sup>test 123</sup></p>');276 editor.setContent('<p>test 123</p>');277 editor.execCommand('SelectAll');278 editor.execCommand('subscript');279 editor.execCommand('subscript');280 LegacyUnit.equal(editor.getContent(), '<p>test 123</p>');281 editor.setContent('<p>test 123</p>');282 editor.execCommand('SelectAll');283 editor.execCommand('superscript');284 editor.execCommand('superscript');285 LegacyUnit.equal(editor.getContent(), '<p>test 123</p>');286 });287 suite.test('indent/outdent', function (editor) {288 editor.setContent('<p>test 123</p>');289 editor.execCommand('SelectAll');290 editor.execCommand('Indent');291 LegacyUnit.equal(editor.getContent(), '<p style="padding-left: 30px;">test 123</p>');292 editor.setContent('<p>test 123</p>');293 editor.execCommand('SelectAll');294 editor.execCommand('Indent');295 editor.execCommand('Indent');296 LegacyUnit.equal(editor.getContent(), '<p style="padding-left: 60px;">test 123</p>');297 editor.setContent('<p>test 123</p>');298 editor.execCommand('SelectAll');299 editor.execCommand('Indent');300 editor.execCommand('Indent');301 editor.execCommand('Outdent');302 LegacyUnit.equal(editor.getContent(), '<p style="padding-left: 30px;">test 123</p>');303 editor.setContent('<p>test 123</p>');304 editor.execCommand('SelectAll');305 editor.execCommand('Outdent');306 LegacyUnit.equal(editor.getContent(), '<p>test 123</p>');307 });308 suite.test('indent/outdent table always uses margin', function (editor) {309 editor.setContent('<table><tbody><tr><td>test</td></tr></tbody></table>');310 editor.execCommand('SelectAll');311 editor.execCommand('Indent');312 LegacyUnit.equal(editor.getContent(), '<table style="margin-left: 30px;"><tbody><tr><td>test</td></tr></tbody></table>');313 editor.setContent('<table><tbody><tr><td>test</td></tr></tbody></table>');314 editor.execCommand('SelectAll');315 editor.execCommand('Indent');316 editor.execCommand('Indent');317 LegacyUnit.equal(editor.getContent(), '<table style="margin-left: 60px;"><tbody><tr><td>test</td></tr></tbody></table>');318 editor.setContent('<table><tbody><tr><td>test</td></tr></tbody></table>');319 editor.execCommand('SelectAll');320 editor.execCommand('Indent');321 editor.execCommand('Indent');322 editor.execCommand('Outdent');323 LegacyUnit.equal(editor.getContent(), '<table style="margin-left: 30px;"><tbody><tr><td>test</td></tr></tbody></table>');324 editor.setContent('<table><tbody><tr><td>test</td></tr></tbody></table>');325 editor.execCommand('SelectAll');326 editor.execCommand('Outdent');327 LegacyUnit.equal(editor.getContent(), '<table><tbody><tr><td>test</td></tr></tbody></table>');328 });329 suite.test('RemoveFormat', function (editor) {330 editor.setContent('<p><em>test</em> <strong>123</strong> <a href="123">123</a> 123</p>');331 editor.execCommand('SelectAll');332 editor.execCommand('RemoveFormat');333 LegacyUnit.equal(editor.getContent(), '<p>test 123 <a href="123">123</a> 123</p>');334 editor.setContent('<p><em><em>test</em> <strong>123</strong> <a href="123">123</a> 123</em></p>');335 editor.execCommand('SelectAll');336 editor.execCommand('RemoveFormat');337 LegacyUnit.equal(editor.getContent(), '<p>test 123 <a href="123">123</a> 123</p>');338 editor.setContent('<p><em>test<span id="x">test <strong>123</strong></span><a href="123">123</a> 123</em></p>');339 editor.selection.select(editor.dom.get('x'));340 editor.execCommand('RemoveFormat');341 LegacyUnit.equal(editor.getContent(), '<p><em>test</em><span id="x">test 123</span><em><a href="123">123</a> 123</em></p>');342 editor.setContent(343 '<p><dfn>dfn tag </dfn> <code>code tag </code> <samp>samp tag</samp> ' +344 '<kbd> kbd tag</kbd> <var> var tag</var> <cite> cite tag</cite> <mark> mark tag</mark> <q> q tag</q></p>'345 );346 editor.execCommand('SelectAll');347 editor.execCommand('RemoveFormat');348 LegacyUnit.equal(editor.getContent(), '<p>dfn tag code tag samp tag kbd tag var tag cite tag mark tag q tag</p>');349 });350 TinyLoader.setup(function (editor, onSuccess, onFailure) {351 Pipeline.async({}, suite.toSteps(editor), onSuccess, onFailure);352 }, {353 add_unload_trigger: false,354 disable_nodechange: true,355 indent: false,356 entities: 'raw',...

Full Screen

Full Screen

shortcodes.js

Source:shortcodes.js Github

copy

Full Screen

...25 c.onRenderMenu.add(function(c, m) {26 sub = m.addMenu({title : 'Typography'});27 sub.add({title : 'Header 1', onclick : function() {28 var str = '[h1]Header H1[/h1]';29 window.tinyMCE.activeEditor.selection.setContent(str);30 }});31 sub.add({title : 'Header 2', onclick : function() {32 var str = '[h2]Header H2[/h2]';33 window.tinyMCE.activeEditor.selection.setContent(str);34 }});35 sub.add({title : 'Header 3', onclick : function() {36 var str = '[h3]Header H3[/h3]';37 window.tinyMCE.activeEditor.selection.setContent(str);38 }});39 40 sub.add({title : 'Header 4', onclick : function() {41 var str = '[h4]Header H4[/h4]';42 window.tinyMCE.activeEditor.selection.setContent(str);43 }});44 45 sub.add({title : 'Header 5', onclick : function() {46 var str = '[h5]Header H5[/h5]';47 window.tinyMCE.activeEditor.selection.setContent(str);48 }});49 50 sub.add({title : 'Medium text size', onclick : function() {51 var str = '[medium]Medium text size example[/medium]';52 window.tinyMCE.activeEditor.selection.setContent(str);53 }});54 55 sub.add({title : 'Code', onclick : function() {56 var str = '[code]Preformatted code example[/code]';57 window.tinyMCE.activeEditor.selection.setContent(str);58 }});59 60 sub.add({title : 'Cite', onclick : function() {61 var str = '[cite author="author name" link="authorsite.com"]2011[/cite]';62 window.tinyMCE.activeEditor.selection.setContent(str);63 }});64 65 sub.add({title : 'Highlight', onclick : function() {66 var str = '[highlight]Highlighted text example[/highlight]';67 window.tinyMCE.activeEditor.selection.setContent(str);68 }});69 70 sub.add({title : 'Acronym', onclick : function() {71 var str = '[acronym title="acronym description"]acronym[/acronym]';72 window.tinyMCE.activeEditor.selection.setContent(str);73 }});74 sub.add({title : 'Abbreviation', onclick : function() {75 var str = '[abbr title="abbreviation description"]abbreviation[/abbr]';76 window.tinyMCE.activeEditor.selection.setContent(str);77 }});78 79 sub.add({title : 'Deleted text', onclick : function() {80 var str = '[del]deleted text example[/del]';81 window.tinyMCE.activeEditor.selection.setContent(str);82 }});83 84 sub.add({title : 'Widget icon', onclick : function() {85 var str = '[icon url=""]';86 window.tinyMCE.activeEditor.selection.setContent(str);87 }});88 89 sub = m.addMenu({title : 'Utility'});90 91 sub.add({title : 'Divider element', onclick : function() {92 var str = '[divider]';93 window.tinyMCE.activeEditor.selection.setContent(str);94 }});95 sub.add({title : 'Icon boxes', onclick : function() {96 var str = '[iconbox url="image url" iconsize="64" title="Title"]descriptive text[/iconbox]';97 window.tinyMCE.activeEditor.selection.setContent(str);98 }});99 sub.add({title : 'Icon boxes centered', onclick : function() {100 var str = '[iconbox center url="image url" title="Title"]descriptive text[/iconbox]';101 window.tinyMCE.activeEditor.selection.setContent(str);102 }});103 104 sub = m.addMenu({title : 'Drop caps'});105 sub.add({title : 'Colored', onclick : function() {106 var str = '[dropcap1]A[/dropcap1]';107 window.tinyMCE.activeEditor.selection.setContent(str);108 }});109 sub.add({title : 'Colored custom', onclick : function() {110 var str = '[dropcap3 color="#ff0000"]A[/dropcap3]';111 window.tinyMCE.activeEditor.selection.setContent(str);112 }});113 sub.add({title : 'Big letter', onclick : function() {114 var str = '[dropcap2]A[/dropcap2]';115 window.tinyMCE.activeEditor.selection.setContent(str);116 }});117 m.addSeparator();118 sub = m.addMenu({title : 'Messages'});119 sub.add({title : 'Notice', onclick : function() {120 var str = '[message type="notice"]Your message[/message]';121 window.tinyMCE.activeEditor.selection.setContent(str);122 }});123 sub.add({title : 'Error', onclick : function() {124 var str = '[message type="error"]Your message[/message]';125 window.tinyMCE.activeEditor.selection.setContent(str);126 }});127 sub.add({title : 'Warning', onclick : function() {128 var str = '[message type="warning"]Your message[/message]';129 window.tinyMCE.activeEditor.selection.setContent(str);130 }});131 sub.add({title : 'Success', onclick : function() {132 var str = '[message type="success"]Your message[/message]';133 window.tinyMCE.activeEditor.selection.setContent(str);134 }});135 sub.add({title : 'Info', onclick : function() {136 var str = '[message type="info"]Your message[/message]';137 window.tinyMCE.activeEditor.selection.setContent(str);138 }});139 m.addSeparator();140 141 m.add({title : "Pricing table", onclick : function() {142 var str = '[pricingtable cols="3"][plan color="" head_color="" title="Starter" price="FREE" price_tag="" button_url="http://www.google.com" button_text="sign up" button_color="grey"]<ul><li>feature 1</li><li>feature 2</li><li>feature 3</li></ul>[/plan][plan featured color="#5B7825" title="Premium" price="99" price_tag="USD" button_url="http://www.google.com" button_text="sign up" button_color="green"]<ul><li>feature 1</li><li>feature 2</li><li>feature 3</li></ul>[/plan][plan title="Ultimate" price="299" price_tag="USD" button_url="http://www.google.com" button_text="sign up" button_color="grey"]<ul><li>feature 1</li><li>feature 2</li><li>feature 3</li></ul>[/plan][/pricingtable]';143 window.tinyMCE.activeEditor.selection.setContent(str);144 }});145 m.addSeparator();146 147 sub = m.addMenu({title : 'Small button'});148 149 sub.add({title : "Red", onclick : function() {150 var str = '[button-small color="red" link="www.google.com"]Small button Red[/button-small]';151 window.tinyMCE.activeEditor.selection.setContent(str);152 }});153 sub.add({title : "Blue", onclick : function() {154 var str = '[button-small color="blue" link="www.google.com"]Small button Blue[/button-small]';155 window.tinyMCE.activeEditor.selection.setContent(str);156 }});157 sub.add({title : "Green", onclick : function() {158 var str = '[button-small color="green" link="www.google.com"]Small button Green[/button-small]';159 window.tinyMCE.activeEditor.selection.setContent(str);160 }});161 sub.add({title : "Yellow", onclick : function() {162 var str = '[button-small color="yellow" link="www.google.com"]Small button Yellow[/button-small]';163 window.tinyMCE.activeEditor.selection.setContent(str);164 }});165 sub.add({title : "Brown", onclick : function() {166 var str = '[button-small color="brown" link="www.google.com"]Small button Brown[/button-small]';167 window.tinyMCE.activeEditor.selection.setContent(str);168 }});169 sub.add({title : "Purple", onclick : function() {170 var str = '[button-small color="purple" link="www.google.com"]Small button Purple[/button-small]';171 window.tinyMCE.activeEditor.selection.setContent(str);172 }});173 sub.add({title : "Graphite", onclick : function() {174 var str = '[button-small color="graphite" link="www.google.com"]Small button Graphite[/button-small]';175 window.tinyMCE.activeEditor.selection.setContent(str);176 }});177 sub.add({title : "Grey", onclick : function() {178 var str = '[button-small color="grey" link="www.google.com"]Small button Grey[/button-small]';179 window.tinyMCE.activeEditor.selection.setContent(str);180 }});181 182 sub = m.addMenu({title : 'Medium button'});183 sub.add({title : "Red", onclick : function() {184 var str = '[button-medium color="red" link="www.google.com"]Medium button Red[/button-medium]';185 window.tinyMCE.activeEditor.selection.setContent(str);186 }});187 sub.add({title : "Blue", onclick : function() {188 var str = '[button-medium color="blue" link="www.google.com"]Medium button Blue[/button-medium]';189 window.tinyMCE.activeEditor.selection.setContent(str);190 }});191 sub.add({title : "Green", onclick : function() {192 var str = '[button-medium color="green" link="www.google.com"]Medium button Green[/button-medium]';193 window.tinyMCE.activeEditor.selection.setContent(str);194 }});195 sub.add({title : "Yellow", onclick : function() {196 var str = '[button-medium color="yellow" link="www.google.com"]Medium button Yellow[/button-medium]';197 window.tinyMCE.activeEditor.selection.setContent(str);198 }});199 sub.add({title : "Brown", onclick : function() {200 var str = '[button-medium color="brown" link="www.google.com"]Medium button Brown[/button-medium]';201 window.tinyMCE.activeEditor.selection.setContent(str);202 }});203 sub.add({title : "Purple", onclick : function() {204 var str = '[button-medium color="purple" link="www.google.com"]Medium button Purple[/button-medium]';205 window.tinyMCE.activeEditor.selection.setContent(str);206 }});207 sub.add({title : "Graphite", onclick : function() {208 var str = '[button-medium color="graphite" link="www.google.com"]Medium button Graphite[/button-medium]';209 window.tinyMCE.activeEditor.selection.setContent(str);210 }});211 sub.add({title : "Grey", onclick : function() {212 var str = '[button-medium color="grey" link="www.google.com"]Medium button Grey[/button-medium]';213 window.tinyMCE.activeEditor.selection.setContent(str);214 }});215 sub = m.addMenu({title : 'Large button'});216 217 sub.add({title : "Red", onclick : function() {218 var str = '[button-large color="red" link="www.google.com"]Large button Red[/button-large]';219 window.tinyMCE.activeEditor.selection.setContent(str);220 }});221 sub.add({title : "Blue", onclick : function() {222 var str = '[button-large color="blue" link="www.google.com"]Large button Blue[/button-large]';223 window.tinyMCE.activeEditor.selection.setContent(str);224 }});225 sub.add({title : "Green", onclick : function() {226 var str = '[button-large color="green" link="www.google.com"]Large button Green[/button-large]';227 window.tinyMCE.activeEditor.selection.setContent(str);228 }});229 sub.add({title : "Yellow", onclick : function() {230 var str = '[button-large color="yellow" link="www.google.com"]Large button Yellow[/button-large]';231 window.tinyMCE.activeEditor.selection.setContent(str);232 }});233 sub.add({title : "Brown", onclick : function() {234 var str = '[button-large color="brown" link="www.google.com"]Large button Brown[/button-large]';235 window.tinyMCE.activeEditor.selection.setContent(str);236 }});237 sub.add({title : "Purple", onclick : function() {238 var str = '[button-large color="purple" link="www.google.com"]Large button Purple[/button-large]';239 window.tinyMCE.activeEditor.selection.setContent(str);240 }});241 sub.add({title : "Graphite", onclick : function() {242 var str = '[button-large color="graphite" link="www.google.com"]Large button Graphite[/button-large]';243 window.tinyMCE.activeEditor.selection.setContent(str);244 }});245 sub.add({title : "Grey", onclick : function() {246 var str = '[button-large color="grey" link="www.google.com"]Large button Grey[/button-large]';247 window.tinyMCE.activeEditor.selection.setContent(str);248 }});249 m.add({title : "Custom color button", onclick : function() {250 var str = '[button-custom color="#5E80A6" link="www.google.com"]Button with custom color[/button-custom]';251 window.tinyMCE.activeEditor.selection.setContent(str);252 }});253 m.addSeparator();254 sub = m.addMenu({title : 'Columns'});255 256 sub.add({title : 'Third', 'class' : 'mceMenuItemTitle'}).setDisabled(1);257 258 sub.add({title : 'One third', onclick : function() {259 var str = '[one-third]Your content here[/one-third]';260 window.tinyMCE.activeEditor.selection.setContent(str);261 }});262 sub.add({title : 'Two third', onclick : function() {263 var str = '[two-third]Your content here[/two-third]';264 window.tinyMCE.activeEditor.selection.setContent(str);265 }});266 267 sub.add({title : 'Fourth', 'class' : 'mceMenuItemTitle'}).setDisabled(1);268 269 sub.add({title : 'One Fourh', onclick : function() {270 var str = '[one-fourth]Your content here[/one-fourth]';271 window.tinyMCE.activeEditor.selection.setContent(str);272 }});273 274 sub.add({title : 'Two Fourh', onclick : function() {275 var str = '[two-fourth]Your content here[/two-fourth]';276 window.tinyMCE.activeEditor.selection.setContent(str);277 }});278 279 sub.add({title : 'Three Fourh', onclick : function() {280 var str = '[three-fourth]Your content here[/three-fourth]';281 window.tinyMCE.activeEditor.selection.setContent(str);282 }});283 284 sub.add({title : 'Fifth', 'class' : 'mceMenuItemTitle'}).setDisabled(1);285 286 sub.add({title : 'One Fifth', onclick : function() {287 var str = '[one-fifth]Your content here[/one-fifth]';288 window.tinyMCE.activeEditor.selection.setContent(str);289 }});290 291 sub.add({title : 'Two Fifth', onclick : function() {292 var str = '[two-fifth]Your content here[/two-fifth]';293 window.tinyMCE.activeEditor.selection.setContent(str);294 }});295 296 sub.add({title : 'Three Fifth', onclick : function() {297 var str = '[three-fifth]Your content here[/three-fifth]';298 window.tinyMCE.activeEditor.selection.setContent(str);299 }});300 301 sub.add({title : 'Four Fifth', onclick : function() {302 var str = '[four-fifth]Your content here[/four-fifth]';303 window.tinyMCE.activeEditor.selection.setContent(str);304 }});305 sub.add({title : 'Full width', onclick : function() {306 var str = '[full]Your content here[/full]';307 window.tinyMCE.activeEditor.selection.setContent(str);308 }});309 310 m.addSeparator();311 sub = m.addMenu({title : 'Tabs'});312 313 sub.add({title : 'Tab container', onclick : function() {314 var str = '[tabs][tab title="The title of your tab"]Content of the tab[/tab] [tab title="The title of your tab 2"]Content of the tab 2[/tab][/tabs]';315 window.tinyMCE.activeEditor.selection.setContent(str);316 }});317 sub.add({title : 'Single tab', onclick : function() {318 var str = '[tab title="The title of your tab"]Content of the tab[/tab]';319 window.tinyMCE.activeEditor.selection.setContent(str);320 }});321 sub = m.addMenu({title : 'Accordion'});322 323 sub.add({title : 'Accordion', onclick : function() {324 var str = '[accordion_container][accordion title="Title example"]Content of accordion[/accordion] [accordion title="Title example 2"]Content of accordion 2[/accordion][/accordion_container]';325 window.tinyMCE.activeEditor.selection.setContent(str);326 }});327 328 /*329 sub.add({title : 'Nested accordion', onclick : function() {330 var str = '[accordion-container][nested-accordion title="Title example"]Content of accordion[/nested-accordion][nested-accordion title="Title example 2"]Content of accordion 2[/nested-accordion][accordion-container]';331 window.tinyMCE.activeEditor.selection.setContent(str);332 }});333 */334 335 m.add({title : 'Toggle item', onclick : function() {336 var str = '[toggle title="Title example"]Content of your toggle[/toggle]';337 window.tinyMCE.activeEditor.selection.setContent(str); 338 }});339 340 m.addSeparator();341 342 m.add({title : 'Youtube/Vimeo video', onclick : function() {343 var str = '[video id="Insert the video URL here"]';344 window.tinyMCE.activeEditor.selection.setContent(str); 345 }});346 m.addSeparator();347 sub = m.addMenu({title : 'Widgets'});348 sub.add({title : 'Page', onclick : function() {349 var str = '[thb_page id="2"]';350 window.tinyMCE.activeEditor.selection.setContent(str); 351 }});352 sub.add({title : 'Latest posts', onclick : function() {353 var str = '[thb_latest_posts numposts="3" showthumb="1"]';354 window.tinyMCE.activeEditor.selection.setContent(str); 355 }});356 sub.add({title : 'Popular posts', onclick : function() {357 var str = '[thb_popular_posts title="" numposts="3" showthumb="1"]';358 window.tinyMCE.activeEditor.selection.setContent(str); 359 }});360 sub.add({title : 'Posts from a category', onclick : function() {361 var str = '[thb_category_posts title="" numposts="3" showthumb="1" cat="2"]';362 window.tinyMCE.activeEditor.selection.setContent(str); 363 }});364 sub.add({title : 'Latest works', onclick : function() {365 var str = '[thb_latest_works numposts="3" showthumb="1"]';366 window.tinyMCE.activeEditor.selection.setContent(str); 367 }});368 sub.add({title : 'Twitter', onclick : function() {369 var str = '[thb_twitter twitter_id="thehappybit" twitter_count="3"]';370 window.tinyMCE.activeEditor.selection.setContent(str); 371 }});372 sub.add({title : 'Flickr', onclick : function() {373 var str = '[thb_flickr flickr_id="Your flickr ID (via idGettr)" flickr_count="3"]';374 window.tinyMCE.activeEditor.selection.setContent(str); 375 }});376 sub.add({title : 'Social', onclick : function() {377 var str = '[thb_social]';378 window.tinyMCE.activeEditor.selection.setContent(str); 379 }});380 sub.add({title : 'Map', onclick : function() {381 var str = '[thb_map title="" latlong="10,10" zoom="10", height="200" width="300"]';382 window.tinyMCE.activeEditor.selection.setContent(str); 383 }});384 sub.add({title : 'Contact infos', onclick : function() {385 var str = '[thb_contact]';386 window.tinyMCE.activeEditor.selection.setContent(str); 387 }});388 sub.add({title : 'Testimonials', onclick : function() {389 var str = '[thb_testimonials id="" items="3" style="1" title=""]';390 window.tinyMCE.activeEditor.selection.setContent(str); 391 }});392 393 });394 // Return the new splitbutton instance395 return c;396 }397 return null;398 }399 });400 tinymce.PluginManager.add('shortcodes', tinymce.plugins.shortcodes);...

Full Screen

Full Screen

rescue_shortcodes_tinymce.js

Source:rescue_shortcodes_tinymce.js Github

copy

Full Screen

...9 var rescueDummyContent = 'Sample Content';10 }11 // Boxes12 if(id == "blueBox") {13 tinyMCE.activeEditor.selection.setContent('[rescue_box color="blue" text_align="left" width="100%" float="none"]<br />' + rescueDummyContent + '<br />[/rescue_box]');14 }15 if(id == "grayBox") {16 tinyMCE.activeEditor.selection.setContent('[rescue_box color="gray" text_align="left" width="100%" float="none"]<br />' + rescueDummyContent + '<br />[/rescue_box]');17 }18 if(id == "greenBox") {19 tinyMCE.activeEditor.selection.setContent('[rescue_box color="green" text_align="left" width="100%" float="none"]<br />' + rescueDummyContent + '<br />[/rescue_box]');20 }21 if(id == "redBox") {22 tinyMCE.activeEditor.selection.setContent('[rescue_box color="red" text_align="left" width="100%" float="none"]<br />' + rescueDummyContent + '<br />[/rescue_box]');23 }24 if(id == "yellowBox") {25 tinyMCE.activeEditor.selection.setContent('[rescue_box color="yellow" text_align="left" width="100%" float="none"]<br />' + rescueDummyContent + '<br />[/rescue_box]');26 }27 // Button28 if(id == "button") {29 tinyMCE.activeEditor.selection.setContent('[rescue_button color="blue" url="http://rescuethemes.com" title="Visit Site" target="blank" class="right" border_radius=""]' + rescueDummyContent + '[/rescue_button]');30 }31 // Clear Floats32 if(id == "clear") {33 tinyMCE.activeEditor.selection.setContent('[rescue_clear_floats]');34 }35 // Icon36 if(id == "icon") {37 tinyMCE.activeEditor.selection.setContent('[icon type="cloud" size="3x" pull="left" color="#cccccc"]');38 }39 // Columns40 if(id == "half") {41 tinyMCE.activeEditor.selection.setContent('[rescue_column size="one-half" position="first"]<br />' + rescueDummyContent + '<br />[/rescue_column]');42 }43 if(id == "third") {44 tinyMCE.activeEditor.selection.setContent('[rescue_column size="one-third" position="first"]' + rescueDummyContent + '[/rescue_column]');45 }46 if(id == "fourth") {47 tinyMCE.activeEditor.selection.setContent('[rescue_column size="one-fourth" position="first"]' + rescueDummyContent + '[/rescue_column]');48 }49 if(id == "fifth") {50 tinyMCE.activeEditor.selection.setContent('[rescue_column size="one-fifth" position="first"]' + rescueDummyContent + '[/rescue_column]');51 }52 if(id == "sixth") {53 tinyMCE.activeEditor.selection.setContent('[rescue_column size="one-sixth" position="first"]' + rescueDummyContent + '[/rescue_column]');54 }55 if(id == "twothird") {56 tinyMCE.activeEditor.selection.setContent('[rescue_column size="two-third" position="first"]' + rescueDummyContent + '[/rescue_column]');57 }58 if(id == "threefourth") {59 tinyMCE.activeEditor.selection.setContent('[rescue_column size="three-fourth" position="first"]' + rescueDummyContent + '[/rescue_column]');60 }61 if(id == "twofifth") {62 tinyMCE.activeEditor.selection.setContent('[rescue_column size="two-fifth" position="first"]' + rescueDummyContent + '[/rescue_column]');63 }64 if(id == "threefifth") {65 tinyMCE.activeEditor.selection.setContent('[rescue_column size="three-fifth" position="first"]' + rescueDummyContent + '[/rescue_column]');66 }67 // Google Map68 if(id == "googlemap") {69 tinyMCE.activeEditor.selection.setContent('[rescue_googlemap title="Rescue Themes Offices" location="5046 S Greenwood Ave, Chicago, IL 60615" zoom="14" height=250]');70 }71 // Highlight72 if(id == "blueHighlight") {73 tinyMCE.activeEditor.selection.setContent('[rescue_highlight color="blue"]' + rescueDummyContent + '[/rescue_highlight]');74 }75 if(id == "grayHighlight") {76 tinyMCE.activeEditor.selection.setContent('[rescue_highlight color="gray"]' + rescueDummyContent + '[/rescue_highlight]');77 }78 if(id == "greenHighlight") {79 tinyMCE.activeEditor.selection.setContent('[rescue_highlight color="green"]' + rescueDummyContent + '[/rescue_highlight]');80 }81 if(id == "redHighlight") {82 tinyMCE.activeEditor.selection.setContent('[rescue_highlight color="red"]' + rescueDummyContent + '[/rescue_highlight]');83 }84 if(id == "yellowHighlight") {85 tinyMCE.activeEditor.selection.setContent('[rescue_highlight color="yellow"]' + rescueDummyContent + '[/rescue_highlight]');86 }87 //Spacing88 if(id == "spacing") {89 tinyMCE.activeEditor.selection.setContent('[rescue_spacing size="40px"]');90 }91 //General Tabs92 if(id == "tabs") {93 tinyMCE.activeEditor.selection.setContent('[rescue_tabgroup]<br />[rescue_tab title="First Tab"]<br />First tab content<br />[/rescue_tab]<br />[rescue_tab title="Second Tab"]<br />Second Tab Content.<br />[/rescue_tab]<br />[/rescue_tabgroup]');94 }95 //Donation Tabs96 if(id == "donationtabs") {97 tinyMCE.activeEditor.selection.setContent('[rescue_donation_tabgroup group_title="Help Us Reach our Goal"]<br />[rescue_donation_tab title="Total"]<br />Example Fundraiser<br />[rescue_progressbar title="Example" percentage="75" color="#f1c40f"]<br />Example Fundraiser<br />[rescue_progressbar title="Example" percentage="45" color="#1abc9c"]<br />[/rescue_donation_tab]<br />[rescue_donation_tab title="Goal"]<br />Second tab content. You can enter any text that you would like here and it will be displayed within the second tab content.<br />[rescue_clear_floats]<br />[rescue_button color="black" url="http://rescuethemes.com" title="Visit Site" target="blank" class="right" border_radius=""]Sample Content[/rescue_button]<br />[/rescue_donation_tab]<br />[rescue_donation_tab title="Donate"]<br />Third tab content. You can enter any text that you would like here and it will be displayed within the third tab content<br />[rescue_button color="blue" url="http://rescuethemes.com" title="Visit Site" target="blank" class="right" border_radius=""]Sample Content[/rescue_button]<br />[/rescue_donation_tab]<br />[/rescue_donation_tabgroup]');98 }99 //Toggle100 if(id == "toggle") {101 tinyMCE.activeEditor.selection.setContent('[rescue_toggle title="This Is Your Toggle Title"]' + rescueDummyContent + '[/rescue_toggle]');102 }103 // Animations104 if(id == "slideInDown") {105 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="slideInDown" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');106 }107 if(id == "slideInLeft") {108 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="slideInLeft" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');109 }110 if(id == "slideInRight") {111 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="slideInRight" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');112 }113 if(id == "fadeIn") {114 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="fadeIn" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');115 }116 if(id == "fadeInLeft") {117 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="fadeInLeft" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');118 }119 if(id == "fadeInRight") {120 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="fadeInRight" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');121 }122 if(id == "fadeInUp") {123 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="fadeInUp" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');124 }125 if(id == "fadeInDown") {126 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="fadeInDown" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');127 }128 if(id == "bounceIn") {129 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="bounceIn" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');130 }131 if(id == "bounceInLeft") {132 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="bounceInLeft" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');133 }134 if(id == "bounceInRight") {135 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="bounceInRight" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');136 }137 if(id == "bounceInUp") {138 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="bounceInUp" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');139 }140 if(id == "bounceInDown") {141 tinyMCE.activeEditor.selection.setContent('[rescue_animate type="bounceInDown" duration="2s" delay="0s" iteration="1"]' + rescueDummyContent + '[/rescue_animate]');142 }143 return false;144}145function rescue_render_item(parent_item, title, id) {146 var item = {147 'text': title,148 onclick: function(){ rescue_on_click(id); }149 };150 parent_item.push(item);151}152function rescue_get_menu() {153 var menu = [154 {155 text: 'Rescue Shortcodes',...

Full Screen

Full Screen

Editor.js

Source:Editor.js Github

copy

Full Screen

...24 editor.on('change', function(e) {25 level = e.level;26 lastLevel = e.lastLevel;27 });28 editor.setContent('');29 editor.insertContent('a');30 equal(level.content.toLowerCase(), '<p>a</p>');31 equal(lastLevel.content, editor.undoManager.data[0].content);32 editor.off('change');33});34test('Event: beforeExecCommand', function() {35 var cmd, ui, value;36 editor.on('BeforeExecCommand', function(e) {37 cmd = e.command;38 ui = e.ui;39 value = e.value;40 e.preventDefault();41 });42 editor.setContent('');43 editor.insertContent('a');44 equal(editor.getContent(), '');45 equal(cmd, 'mceInsertContent');46 equal(ui, false);47 equal(value, 'a');48 editor.off('BeforeExecCommand');49 editor.setContent('');50 editor.insertContent('a');51 equal(editor.getContent(), '<p>a</p>');52});53test('urls - relativeURLs', function() {54 editor.settings.relative_urls = true;55 editor.documentBaseURI = new tinymce.util.URI('http://www.site.com/dirA/dirB/dirC/');56 editor.setContent('<a href="test.html">test</a>');57 equal(editor.getContent(), '<p><a href="test.html">test</a></p>');58 editor.setContent('<a href="../test.html">test</a>');59 equal(editor.getContent(), '<p><a href="../test.html">test</a></p>');60 editor.setContent('<a href="test/test.html">test</a>');61 equal(editor.getContent(), '<p><a href="test/test.html">test</a></p>');62 editor.setContent('<a href="/test.html">test</a>');63 equal(editor.getContent(), '<p><a href="../../../test.html">test</a></p>');64 editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');65 equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');66 editor.setContent('<a href="//www.site.com/test/file.htm">test</a>');67 equal(editor.getContent(), '<p><a href="../../../test/file.htm">test</a></p>');68 editor.setContent('<a href="//www.somesite.com/test/file.htm">test</a>');69 equal(editor.getContent(), '<p><a href="//www.somesite.com/test/file.htm">test</a></p>');70});71test('urls - absoluteURLs', function() {72 editor.settings.relative_urls = false;73 editor.settings.remove_script_host = true;74 editor.documentBaseURI = new tinymce.util.URI('http://www.site.com/dirA/dirB/dirC/');75 editor.setContent('<a href="test.html">test</a>');76 equal(editor.getContent(), '<p><a href="/dirA/dirB/dirC/test.html">test</a></p>');77 editor.setContent('<a href="../test.html">test</a>');78 equal(editor.getContent(), '<p><a href="/dirA/dirB/test.html">test</a></p>');79 editor.setContent('<a href="test/test.html">test</a>');80 equal(editor.getContent(), '<p><a href="/dirA/dirB/dirC/test/test.html">test</a></p>');81 editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');82 equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');83 editor.settings.relative_urls = false;84 editor.settings.remove_script_host = false;85 editor.setContent('<a href="test.html">test</a>');86 equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/dirC/test.html">test</a></p>');87 editor.setContent('<a href="../test.html">test</a>');88 equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/test.html">test</a></p>');89 editor.setContent('<a href="test/test.html">test</a>');90 equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/dirC/test/test.html">test</a></p>');91 editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');92 equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');93 editor.setContent('<a href="//www.site.com/test/file.htm">test</a>');94 equal(editor.getContent(), '<p><a href="//www.site.com/test/file.htm">test</a></p>');95 editor.setContent('<a href="//www.somesite.com/test/file.htm">test</a>');96 equal(editor.getContent(), '<p><a href="//www.somesite.com/test/file.htm">test</a></p>');97});98test('WebKit Serialization range bug', function() {99 expect(1);100 if (tinymce.isIE) {101 ok(true, "Skip IE");102 } else {103 // Note that if we create the P with this invalid content directly, Chrome cleans it up differently to other browsers so we don't104 // wind up testing the serialization functionality we were aiming for and the test fails.105 var p = editor.dom.create('p', {}, '123<table><tbody><tr><td>X</td></tr></tbody></table>456');106 editor.dom.replace(p, editor.getBody().firstChild);107 equal(editor.getContent(), '<p>123</p>\n<table>\n<tbody>\n<tr>\n<td>X</td>\n</tr>\n</tbody>\n</table>\n<p>456</p>');108 }109});110test('editor_methods - getParam', function() {111 expect(5);112 editor.settings.test = 'a,b,c';113 equal(editor.getParam('test', '', 'hash').c, 'c');114 editor.settings.test = 'a';115 equal(editor.getParam('test', '', 'hash').a, 'a');116 editor.settings.test = 'a=b';117 equal(editor.getParam('test', '', 'hash').a, 'b');118 editor.settings.test = 'a=b;c=d,e';119 equal(editor.getParam('test', '', 'hash').c, 'd,e');120 editor.settings.test = 'a=b,c=d';121 equal(editor.getParam('test', '', 'hash').c, 'd');122});123test('setContent', function() {124 var count;125 expect(4);126 function callback(e) {127 e.content = e.content.replace(/test/, 'X');128 count++;129 }130 editor.on('SetContent', callback);131 editor.on('BeforeSetContent', callback);132 count = 0;133 editor.setContent('<p>test</p>');134 equal(editor.getContent(), "<p>X</p>");135 equal(count, 2);136 editor.off('SetContent', callback);137 editor.off('BeforeSetContent', callback);138 count = 0;139 editor.setContent('<p>test</p>');140 equal(editor.getContent(), "<p>test</p>");141 equal(count, 0);142});143test('custom elements', function() {144 expect(1);145 editor.setContent('<custom1>c1</custom1><custom2>c1</custom2>');146 equal(editor.getContent().replace(/[\r\n]/g, ''), '<custom1>c1</custom1><p><custom2>c1</custom2></p>');...

Full Screen

Full Screen

SpecToaster.js

Source:SpecToaster.js Github

copy

Full Screen

...72 });73 });74 describe('setContent', function () {75 it('does not add items with empty message', function () {76 widget.setContent();77 expect(widget.toasterItems.length).toEqual(0);78 });79 it('does not add duplicate items', function () {80 widget.setContent('a', widget.defaultClass);81 widget.setContent('a', widget.defaultClass);82 expect(widget.toasterItems.length).toEqual(1);83 });84 it('does not add duplicate items', function () {85 widget.setContent('a', widget.defaultClass);86 widget.setContent('a', widget.defaultClass);87 widget.setContent('a', 'danger');88 expect(widget.toasterItems.length).toEqual(2);89 });90 it('removes first item when maxItems is reached', function () {91 widget.maxItems = 2;92 widget.setContent('1', widget.defaultClass);93 widget.setContent('2', widget.defaultClass);94 widget.setContent('3', widget.defaultClass);95 expect(widget.toasterItems.length).toEqual(widget.maxItems);96 expect(widget.toasterItems[0].message).toEqual('2');97 });98 });99 describe('isDuplicate', function () {100 it('returns true if duplicate', function () {101 expect(widget.isDuplicate([{message: 'a', cssClass: 'b'}], 'a', 'b')).toEqual(true);102 expect(widget.isDuplicate([{message: 'a', cssClass: 'c'}, {message: 'a', cssClass: 'b'}], 'a', 'b')).toEqual(true);103 });104 it('returns false if no duplicate', function () {105 expect(widget.isDuplicate([{message: 'a', cssClass: 'b'}], 'a', 'c')).toEqual(false);106 expect(widget.isDuplicate([{message: 'a', cssClass: 'c'}, {message: 'a', cssClass: 'b'}], 'a', 'd')).toEqual(false);107 expect(widget.isDuplicate([], 'a', 'b')).toEqual(false);108 });...

Full Screen

Full Screen

shortcodes-tinymce.js

Source:shortcodes-tinymce.js Github

copy

Full Screen

...7 menu: [8 {9 text: 'Design Elements',10 menu: [11 { text: 'Button', onclick: function(){ editor.selection.setContent('[button color="red" url="http://www.url.com" size="medium"]' + editor.selection.getContent() + '[/button]'); } },12 { text: 'Notice', onclick: function(){ editor.selection.setContent('[notice]' + editor.selection.getContent() + '[/notice]'); } },13 { text: 'Message', onclick: function(){ editor.selection.setContent('[message type="info"]' + editor.selection.getContent() + '[/message]'); } },14 { text: 'Progress', onclick: function(){ editor.selection.setContent('[progress color="red" icon="" size="" value="" title="Progress Bar"]'); } },15 { text: 'Mini Feature', onclick: function(){ editor.selection.setContent('[feature icon="flag" style="horizontal" title="Title"]' + editor.selection.getContent() + '[/feature]'); } },16 { text: 'Team Member', onclick: function(){ editor.selection.setContent('[team image="" name="Member Name" title="Job Title" web="" facebook="" twitter="" gplus=""]' + editor.selection.getContent() + '[/team]'); } },17 { text: 'Testimonial', onclick: function(){ editor.selection.setContent('[testimonial image="" name="Testimonial Name" title="Job Title"]' + editor.selection.getContent() + '[/testimonial]'); } },18 { text: 'Counter', onclick: function(){ editor.selection.setContent('[counter icon="ok" Title="Counter Title" number="999"]' + editor.selection.getContent() + '[/counter]'); } }19 ]20 },{21 text: 'Interactive',22 menu: [ 23 { text: 'Accordion', onclick: function(){ editor.selection.setContent('[accordion title="Title" state="open"]' + editor.selection.getContent() + '[/accordion]'); } },24 { text: 'Tabbed Content', onclick: function(){ editor.selection.setContent('[tabs][tab title="Title"]' + editor.selection.getContent() + '[/tab][/tabs]'); } },25 { text: 'Slideshow', onclick: function(){ editor.selection.setContent('[slideshow][slide]' + editor.selection.getContent() + '[/slide][/slideshow]'); } },26 { text: 'Map', onclick: function(){ editor.selection.setContent('[map latitude="" longitude="" color="" height="400"]'); } },27 { text: 'Pricing Table', onclick: function(){ editor.selection.setContent('[pricing_table][pricing_item title="Title" price="100" coin="$" url="" urltitle="Read More"]' + editor.selection.getContent() + '[/pricing_item][/pricing_table]'); } },28 ]29 },{30 text: 'Content',31 menu: [ 32 { text: 'Dropcap', onclick: function(){ editor.selection.setContent('[dropcap style="square"]' + editor.selection.getContent() + '[/dropcap]'); } },33 { text: 'Leading', onclick: function(){ editor.selection.setContent('[leading]' + editor.selection.getContent() + '[/leading]'); } },34 { text: 'List', onclick: function(){ editor.selection.setContent('[list icon="ok" style="round"]' + editor.selection.getContent() + '[/list]'); } },35 { text: 'Post List', onclick: function(){ editor.selection.setContent('[posts type="post" number="5" columns="1"]'); } },36 ]37 },{38 text: 'Social',39 menu: [ 40 { text: 'Like Button', onclick: function(){ editor.selection.setContent('[fb_like url="" style="standard" font="arial" action="like" width="450" height="30" position="none"]'); } },41 { text: 'Tweet Button', onclick: function(){ editor.selection.setContent('[tweet url="" style="none" font="arial" action="like" width="450" height="30" position="none"]'); } },42 { text: '+1 Button', onclick: function(){ editor.selection.setContent('[gplus counter="" style="" width="450" height="30" position="none"]'); } },43 ]44 },{45 text: 'Layout',46 menu: [ 47 { text: 'Two Columns', onclick: function(){ editor.selection.setContent('[column_half]<br><br>Column<br><br>[/column_half][column_half_last]<br><br>Column<br><br>[/column_half_last]'); } },48 { text: 'Three Columns', onclick: function(){ editor.selection.setContent('[column_third]<br><br>Column<br><br>[/column_third][column_third]<br><br>Column<br><br>[/column_third][column_third_last]<br><br>Column<br><br>[/column_third_last]'); } },49 { text: 'Four Columns', onclick: function(){ editor.selection.setContent('[column_fourth]<br><br>Column<br><br>[/column_fourth][column_fourth]<br><br>Column<br><br>[/column_fourth][column_fourth]<br><br>Column<br><br>[/column_fourth][column_fourth_last]<br><br>Column<br><br>[/column_fourth_last]'); } },50 { text: 'Five Columns', onclick: function(){ editor.selection.setContent('[column_fifth]<br><br>Column<br><br>[/column_fifth][column_fifth]<br><br>Column<br><br>[/column_fifth][column_fifth]<br><br>Column<br><br>[/column_fifth][column_fifth]<br><br>Column<br><br>[/column_fifth][column_fifth_last]<br><br>Column<br><br>[/column_fifth_last]'); } },51 { text: 'Separator', onclick: function(){ editor.selection.setContent('[separator type="top"]' + editor.selection.getContent() + '[/separator]'); } },52 { text: 'Section', onclick: function(){ editor.selection.setContent('[section background="#666666" color="dark"]' + editor.selection.getContent() + '[/section]'); } },53 ]54 }5556 ]57 });58 }); ...

Full Screen

Full Screen

SectionImgImg.js

Source:SectionImgImg.js Github

copy

Full Screen

...8 name={`scr${props.index}`} 9 to={!props.last ? `scr${props.index + 1}` : false}10 >11 <Input 12 setContent = { (value) => { props.setContent(props.index, "title", value) } }13 />14 <div className="heroes__section__content">15 <div style = {{ width: "45%" }}>16 <Dropzone 17 setContent = { (value) => { props.setContent(props.index, "img1", value) } }18 />19 <Input 20 setContent = { (value) => { props.setContent(props.index, "img_sign1", value) } }21 />22 </div>23 <div style = {{ width: "45%" }}>24 <Dropzone 25 setContent = { (value) => { props.setContent(props.index, "img2", value) } }26 />27 <Input 28 setContent = { (value) => { props.setContent(props.index, "img_sign2", value) } }29 />30 </div>31 </div>32 <Input 33 setContent = { (value) => { props.setContent(props.index, "subtitle", value) } }34 />35 <button 36 className="open-sidebar-btn"37 onClick = {() => props.delSection(props.index)}38 > - </button>39 </HeroesSection>40 </>41 )42}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.setContent(fs.readFileSync('index.html').toString());7 await page.screenshot({path: 'example.png'});8 await browser.close();9})();10const puppeteer = require('puppeteer');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 await page.setContent(`15 `);16 await page.screenshot({path: 'example.png'});17 await browser.close();18})();19const puppeteer = require('puppeteer');20(async () => {21 const browser = await puppeteer.launch();22 const page = await browser.newPage();23 await page.setContent(`24 `, { waitUntil: 'networkidle0' });25 await page.screenshot({path: 'example.png'});26 await browser.close();27})();28const puppeteer = require('puppeteer');29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 await page.setContent(`

Full Screen

Using AI Code Generation

copy

Full Screen

1let fs = require("fs");2let puppeteer = require("puppeteer");3let browserStartPromise = puppeteer.launch({4});5let browserInstance;6browserStartPromise.then(function (browser) {7 browserInstance = browser;8 let newPagePromise = browserInstance.newPage();9 return newPagePromise;10}).then(function (newPage) {11 return pageOpenPromise;12}).then(function () {13 let pageContentPromise = browserInstance.pages();14 return pageContentPromise;15}).then(function (pages) {16 let page = pages[0];17 let pageContent = page.content();18 return pageContent;19}).then(function (html) {20 console.log(html);21 fs.writeFileSync("google.html", html);22}).catch(function (err) {23 console.log(err);24})25let fs = require("fs");26let puppeteer = require("puppeteer");27let browserStartPromise = puppeteer.launch({28});29let browserInstance;30browserStartPromise.then(function (browser) {31 browserInstance = browser;32 let newPagePromise = browserInstance.newPage();33 return newPagePromise;34}).then(function (newPage) {35 return pageOpenPromise;36}).then(function () {37 let pageContentPromise = browserInstance.pages();38 return pageContentPromise;39}).then(function (pages) {40 let page = pages[0];41 let pageContent = page.evaluate(function () {42 let title = document.title;43 return title;44 });45 return pageContent;46}).then(function (title) {47 console.log(title);48}).catch(function (err) {49 console.log(err);50})51let fs = require("fs");52let puppeteer = require("puppeteer");53let browserStartPromise = puppeteer.launch({54});55let browserInstance;56browserStartPromise.then(function (browser) {

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.setContent('<h1>My Header</h1>');6 await page.screenshot({path: 'screenshot.png'});7 await browser.close();8})();9const puppeteer = require('puppeteer');10(async () => {11 const browser = await puppeteer.launch();12 const page = await browser.newPage();13 await page.setContent('<h1>My Header</h1>');14 await page.screenshot({path: 'screenshot.png'});15 await browser.close();16})();17const puppeteer = require('puppeteer');18(async () => {19 const browser = await puppeteer.launch();20 const page = await browser.newPage();21 await page.setContent('<h1>My Header</h1>');22 await page.screenshot({path: 'screenshot.png'});23 await browser.close();24})();25const puppeteer = require('puppeteer');26(async () => {27 const browser = await puppeteer.launch();28 const page = await browser.newPage();29 await page.setContent('<h1>My Header</h1>');30 await page.screenshot({path: 'screenshot.png'});31 await browser.close();32})();33const puppeteer = require('puppeteer');34(async () => {35 const browser = await puppeteer.launch();36 const page = await browser.newPage();37 await page.setContent('<h1>My Header</h1>');38 await page.screenshot({path: 'screenshot.png'});39 await browser.close();40})();41const puppeteer = require('puppeteer');42(async () => {43 const browser = await puppeteer.launch();44 const page = await browser.newPage();45 await page.setContent('<h1>My Header</h1>');46 await page.screenshot({path: 'screenshot.png'});47 await browser.close();48})();49const puppeteer = require('puppeteer');

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.setContent('<h1> Hello World </h1>');6 await page.screenshot({path: 'example.png'});7 await browser.close();8})();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful