Hi I have succesfully made a custom ajax toolkit with a few buttoms in the footer toolbar as I wish. Now I also want to avoid crtl-v and right-click paste, but have searched, searched and tried everything with no result ... Maybe someone can lead me on the right track, I hope :)
Here below is my code (used with c# on asp.net web pages) which makes a editor control. The first part works, but the last part with the keydown is not working and maybe completely wrong?
Best regards, Lars, Denmark
My Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Windows.Forms;
using AjaxControlToolkit.HTMLEditor;
/// <summary>
/// Særlig editor tilrettet behovet hos Boost Company
/// </summary>
namespace AjaxControlToolkit.HTMLEditor.BoostToolbarButton
{
public class Bold : AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold
{
public override string ToolTip
{
get { return "Fed"; }
}
}
public class Italic : AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic
{
public override string ToolTip
{
get { return "Kursiv"; }
}
}
public class Cut : AjaxControlToolkit.HTMLEditor.ToolbarButton.Cut
{
public override string ToolTip
{
get { return "Klip"; }
}
}
public class Copy : AjaxControlToolkit.HTMLEditor.ToolbarButton.Copy
{
public override string ToolTip
{
get { return "Kopier"; }
}
}
public class PasteText : AjaxControlToolkit.HTMLEditor.ToolbarButton.PasteText
{
public override string ToolTip
{
get { return "Indsæt"; }
}
}
public class InsertLink : AjaxControlToolkit.HTMLEditor.ToolbarButton.InsertLink
{
public override string ToolTip
{
get { return "Indsæt/ret link"; }
}
}
}
namespace BoostKontroller
{
public class BoostEditor : Editor
{
protected override void FillTopToolbar()
{
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.Bold());
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.Italic());
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.Cut());
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.Copy());
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.PasteText());
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.BoostToolbarButton.InsertLink());
}
protected override void FillBottomToolbar()
{
}
void OnKeyDown(KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.V)
{
Clipboard.SetText(string .Empty); ;
}
}
}
}
You can do that:
_paste(false, false);
is to paste with plain text if you want the word paste the function is_paste(true, true);
sControlId
is the client id of the editor.