mathewv
New Creator

WYSIWYG - WordPasteOptions

Could I get an example on how to use this ? I don't see any on the API documentation.

0 Kudos
2 Replies
LanceBeehler
Crownpeak Employee

You can customize the Wysiwyg input experience with the following 'WysiwygParams'  code which provides a <Paste as Text> on/off Icon and until you turn it off all html, excel and word copy/pastes will paste as text.    The example below gives example of some of the parameters available to customize the Wysiwyg.

https://developer.crownpeak.com/Documentation/CMSAPI/WysiwygParams/index.html

i.e. When using this code and you copy from word, excel or html  and paste using ctrl-v you get a pop up window asking if you want to remove formatting or not.    ( the actual editing icons don't work - i get an error))

<%@ Page Language="C#" Inherits="CrownPeak.Internal.Debug.InputInit" %>
<%@ Import Namespace="CrownPeak.CMSAPI" %>
<%@ Import Namespace="CrownPeak.CMSAPI.Services" %>
<%@ Import Namespace="CrownPeak.CMSAPI.CustomLibrary" %>
<!--DO NOT MODIFY CODE ABOVE THIS LINE-->
<%

    WysiwygParams wParams = ServicesInput.FullWYSIWYG();
    wParams.Stylesheet = "/Lance Beehler/_Assets/css/style.css";     ! your css reference goes here
    wParams.ImageFolder = "/";
    wParams.ImageUpload = RelationshipType.Attach;
    wParams.ImageBrowse = RelationshipType.Link;
    wParams.LinkFolder = "/";
    wParams.LinkUpload = RelationshipType.Attach;
    wParams.LinkBrowse = RelationshipType.Link;
    wParams.DesignEditTabs = true;
    wParams.AddButton(FeatureType.Separator);
    wParams.AddCutPasteGroup();
    wParams.AddLinkGroup();
    wParams.AddSimpleStyleGroup();
    wParams.AddJustifyGroup();
    wParams.AddListGroup( FeatureType.None );  //none is used to prevent separator from appearing after group
    wParams.AddButton(FeatureType.upload);
    wParams.AddButton(FeatureType.bold);
    wParams.AddButton(FeatureType.copy);
    wParams.AddColorGroup(FeatureType.None);
    Input.ShowWysiwyg("devbody", "dev_body_field", wParams, width: 950, height: 200);

%>

 

 

I believe

Input.ShowWysiwyg("targeting", "targeting", ServicesInput.MediumWYSIWYG());

also provides the same <Paste as Text> capability

0 Kudos