Telerik Forums
Community Forums Forum
9 answers
204 views

Hello,

Although Telerik is awesome I wish to delete my Telerik account, Telerik Forums account and all of the data associated with this account. Please help me out with this.

 

Thanking You,

With Regards,

Subhadeep Bhattacharyya.

1 answer
64 views
Here's my current code, where on the button clicks I'm opening a popup in which the user can type anything and insert it into the cursor position, it's working fine.

Problem:- When I save my text like this <p>I’m looking for the parsing to keep my deeply nested div structure but the deepest div allows inline content. For some reason, a new div gets injected though. Which I’m later removing. I’d rather not have that hack though. My name is&nbsp;<span contenteditable="false" class="uneditable" style="user-select: none; opacity: 0.5; background-color: red; padding: 2px;" id="12312381829919">rahul</span>.</p>
where rahul is a custom value inserted using a popup with properties like id & style 

but when I parse this value onMount from API, the editor doesn't keep my style and id properties and when inspected the text in the editor looks like 

<p>I’m looking for the parsing to keep my deeply nested div structure but the deepest div allows inline content. For some reason, a new div gets injected though, which I’m later removing. I’d rather not have that hack though. My name is&nbsp;<span contenteditable="false" class="uneditable" >rahul</span>.</p>

which Is without ID and style tag 

here's my code for reference 

import React, { useRef, useState } from "react";
import { Editor, EditorTools, EditorUtils, ProseMirror } from "@progress/kendo-react-editor";
import "@progress/kendo-theme-default/dist/all.css";
import { Button } from "@progress/kendo-react-buttons";
import { Dialog, DialogActionsBar } from "@progress/kendo-react-dialogs";
import { Input } from "components/atoms/input/Input";

export default function KendoEditor({ type, updateData, initalVal }) {
  const [isDialogVisible, setDialogVisible] = useState(false);
  const [customData, setCustomData] = useState("");
  const [value, setValue] = useState("test");
  var initialValue =
    type === "header" || type === "footer" ? initalVal?.data?.content : initalVal?.content;
  const editorRef = useRef(null);
  const {
    Bold,
    Italic,
    Underline,
    Strikethrough,
    Subscript,
    Superscript,
    ForeColor,
    BackColor,
    CleanFormatting,
    AlignLeft,
    AlignCenter,
    AlignRight,
    AlignJustify,
    Indent,
    Outdent,
    OrderedList,
    UnorderedList,
    NumberedList,
    BulletedList,
    Undo,
    Redo,
    FontSize,
    FontName,
    FormatBlock,
    Link,
    Unlink,
    InsertImage,
    ViewHtml,
    InsertTable,
    InsertFile,
    SelectAll,
    Print,
    Pdf,
    TableProperties,
    TableCellProperties,
    AddRowBefore,
    AddRowAfter,
    AddColumnBefore,
    AddColumnAfter,
    DeleteRow,
    DeleteColumn,
    DeleteTable,
    MergeCells,
    SplitCell,
  } = EditorTools;
  const { Schema, EditorView, EditorState } = ProseMirror;
  const nonEditable = {
    name: "nonEditable",
    inline: true,
    group: "inline",
    content: "inline+",
    marks: "",
    attrs: {
      contenteditable: { default: null },
      class: { default: null },
      style: { default: null },
      id: { default: null },
    },
    atom: true,
    parseDOM: [{ tag: "span.uneditable", priority: 51 }],
    toDOM: (node) => [
      "span",
      {
        contenteditable: false,
        class: "uneditable",
        style:
          "user-select: none; opacity: 0.5; background-color: red;text-weight:600;padding:2px;",
        id: node.attrs.id,
      },
      0,
    ],
  };

  const toggleSidebar = (type, props) => {
    return (
      <Button
        onClick={() => {
          setDialogVisible(true);
          //  setActiveProperties(type);
        }}
        onMouseDown={(e) => e.preventDefault()}
        onPointerDown={(e) => e.preventDefault()}
        title="Insert Custom Data"
        imageUrl="https://demos.telerik.com/kendo-ui/content/shared/icons/sports/snowboarding.png"
        imageAlt="KendoReact Buttons Snowboarding icon"
      />
    );
  };

  const handleInsertCustomData = () => {
    const { view } = editorRef.current;
    const schema = view.state.schema;

    // get the new node from the schema
    const nodeType = schema.nodes.nonEditable;

    // create a new node with the custom data
    const node = nodeType.createAndFill(
      {
        class: "uneditable", // Keep the existing classes
        style: "user-select: none; opacity: 0.5; background-color: red;", // Add red background color
        id: "nernksf", // Add unique ID using new Date()
      },
      schema.text(customData)
    );

    // Insert the new node
    EditorUtils.insertNode(view, node);
    view.focus();

    // Close the dialog
    setDialogVisible(false);
    setCustomData("");
  };
  console.log(initialValue);
  const onMount = (event) => {
    const { viewProps } = event;
    const { plugins, schema } = viewProps.state;

    let nodes = schema.spec.nodes.addToEnd("nonEditable", nonEditable);

    const mySchema = new Schema({ nodes: nodes, marks: schema.spec.marks });

    console.log(type, initialValue);
    const doc = EditorUtils.createDocument(mySchema, initialValue ? initialValue : "");

    return new EditorView(
      { mount: event.dom },
      {
        ...event.viewProps,
        state: EditorState.create({ doc, plugins }),
      }
    );
  };
  //console.log(value);
  const handleEditorChange = (event) => {
    const data = event?.html;
    //console.log(data);
    setValue(data);
    if (type === "header" || type === "footer") {
      updateData({ visible: initalVal?.visible, data: { ...initalVal?.data, data } });
    } else {
      updateData({ ...initalVal, data });
    }
  };
  return (
    <div>
      <Editor
        ref={editorRef}
        onMount={onMount}
        onChange={handleEditorChange}
        tools={[
          [Bold, Italic, Underline, Strikethrough],
          [Subscript, Superscript],
          ForeColor,
          BackColor,
          [CleanFormatting],
          [AlignLeft, AlignCenter, AlignRight, AlignJustify],
          [Indent, Outdent],
          [OrderedList, UnorderedList],
          [NumberedList, BulletedList],
          FontSize,
          FontName,
          FormatBlock,
          [SelectAll],
          [Undo, Redo],
          [Link, Unlink, InsertImage, ViewHtml],
          [InsertTable, TableProperties, TableCellProperties],
          [AddRowBefore, AddRowAfter, AddColumnBefore, AddColumnAfter],
          [DeleteRow, DeleteColumn, DeleteTable],
          [MergeCells, SplitCell],
          [
            (props) => toggleSidebar("dataSourceProperties", props),
            (props) => toggleSidebar("formulaProperties", props),
            (props) => toggleSidebar("letterProperties", props),
            (props) => toggleSidebar("conditionBuilder", props),
          ],
        ]}
        contentStyle={{
          height: 320,
        }}
        //value={initialValue}
      />
      {isDialogVisible && (
        <Dialog
          title="Insert Custom Data"
          onClose={() => setDialogVisible(false)}
          visible={isDialogVisible}
        >
          <div>
            <Input
              type="text"
              value={customData}
              onChange={(e) => setCustomData(e.target.value)}
              label="Enter name"
            />

            <DialogActionsBar>
              <button
                className="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
                onClick={() => setDialogVisible(false)}
              >
                No
              </button>
              <button
                className="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
                onClick={handleInsertCustomData}
              >
                Yes
              </button>
            </DialogActionsBar>
          </div>
        </Dialog>
      )}
    </div>
  );
}

1 answer
46 views
i am try to import rtf file with header and footer images it throw the following error,

   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.Lists.HtmlExportListManager.ShouldRestartLevel(List list, Int32 listLevelIndex)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.HtmlContentManager.<ExportParagraph>d__1f.MoveNext()
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.HtmlContentManager.<ExportBlockContainer>d__b.MoveNext()
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.BodyElement.<OnEnumerateInnerElements>d__0.MoveNext()
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.WriteContent(IHtmlWriter writer, IHtmlExportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.Write(IHtmlWriter writer, IHtmlExportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.WriteContent(IHtmlWriter writer, IHtmlExportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.Write(IHtmlWriter writer, IHtmlExportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.Export.HtmlExporter.Export(IHtmlWriter writer, IHtmlExportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider.ExportOverride(RadFlowDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.TextBasedFormatProviderBase`1.Export(T document)
   at Unite.Infrastructure.SQL.Repositories.ConsentRepository.GetHtmlFromDocument(RadFlowDocument document) in D:\WorkSpace\Unite2.0\Dev Branch\Unite\Unite.Infrastructure.SQL\Repositories\ConsentRepository.cs:line 337
0 answers
47 views

I copy on notepad with Telerik script editor installed:

0x7A8F460B47f01B596759Bb2CaE4886ED182101E4

I get while doing paste:

0x7A1e71B4498Ae1a1C3ec13F165a0D655bd082394

 

What kind of modification is it?

 


John
Top achievements
Rank 1
 updated question on 29 Mar 2023
1 answer
72 views

reportParameter  PropertyChanged event handler not working, please help

our application is using this version of telerik -- "telerikReportViewer-12.0.18.125.min.js"

Here is a sample of my code

Telerik.Reporting.ReportParameter reportParameter1 = new Telerik.Reporting.ReportParameter();

reportParameter1.PropertyChanged += ReportParameter1_PropertyChanged;

private void ReportParameter1_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{

       //some code removed 

 }

A break point in ReportParameter1_PropertyChanged is never hit; do you have a SDK or some code snipping of how this event handler is used and how it is called?

Dimitar
Telerik team
 answered on 21 Nov 2022
0 answers
71 views

While uploading multiple files in Async due to the slow internet connection it gave connection errors and file uploading failed and asked to retry the file.

Is there any solution to my problem???

1 more thing can I upload multiple files synchronously???

 

1 answer
157 views
Hello everyone,
I need any suggestions, which automation testing tool for desktop applications should I use? I'm working on a project with a desktop application designed in C#.
Dimitar
Telerik team
 answered on 08 Dec 2021
1 answer
69 views

Good day, will like to request some help here. 

 

How do i GetText from an element 

<a href="/orders/Details/22344">ERP30114</a>

 

this is a link so i want to use the linkText to find click the link

 

Elena
Telerik team
 answered on 10 Nov 2020
18 answers
2.7K+ views
Using the clipboard class in C# or VB.NET is pretty simple for windows applications. However, it gets a little trickier for ASP.Net projects.

Background:
The first question you may ask is "Why would you ever want to use the server's clipboard to do anything?" Good question :). I came accross this problem when I was trying to write a pdf parser that would rasterize the front page and save it into a Bitmap object. From here, you can save it to a file, database, etc. To do this, I was using the Adobe Acrobat com library that comes with Adobe Acrobat 7.0. Unfortunatly, they do not have a function that allows you to simply save to a file. They do, however, let you copy the image to the clipboard and then recover it in whatever format you want.

Problem:
I found some great code here: http://www.codeproject.com/dotnet/pdfthumbnail.asp. This code was written for a C#/VB.Net Windows App and works great if used that way. However, when I tried to use this text in the OnClick event of an ASP Button control, i found that nothing was happening. Turns out, the CopyToClipboard command was working fine, b/c if I traced through, I could press ctrl+v and see the image perfectly. However, when the Clipboard.GetObject method was called, it was always returning Null.

Solution:
After much digging and 2 days of work, I stumbled on the reason: The thread started for the ASP.Net application did not have the right ApartmentState to read the Clipboard class. So, here is what I did to work around this:

protected void Button_Click(object sender, EventArgs e)
{
 Thread cbThread = new Thread(new ThreadStart(CopyToClipboard));
 cbThread.ApartmentState = ApartmentState.STA;
 cbThread.Start();
 cbThread.Join();
}

[STAThread]
protected void CopyToClipboard()
{
/*
In here, put the code that copies AND retrieves from the clipboard.
If you use global variables, the Bitmap you populate here can be used elsewhere in your code.
*/
}

Final Notes:
I do not recommend doing this in a multi-user environment as there is no guarentee that the user that copied to the clipboard will be the one who retrieves from it. Also, images/pdfs can be very large and the clipboard is slow.

I hope this is of some use to someone. It solved my problem and saved me $900 by not having to buy a PDF Rasterizer control. Feel free to respond and let me know if it helped you out or if you have any questions.

~ Oleg Fridman
John
Top achievements
Rank 1
 answered on 06 Aug 2016
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?