Last Updated: 18 May 2021 08:29 by ADMIN
Emin Sadigov
Created on: 18 May 2021 08:28
Category: RichTextBox
Type: Feature Request
RichTextBox: HtmlFormatProvider: Create unique identifier for each document element and allow export/import them
  • Each RichText element should contain a unique id. The id contains DateTime.UtcNow.Ticks. This format is requiring to know which RT elements were added from the last change.
  • Export these ids into html as is and import.
  • For compatibility, id should have a different attribute name, for example:
    <p data-telerik-id="Paragraph637567542110611335">
    	<span data-telerik-id="Span637567542110611345">
    Note: data-* is Global attribute name: https://www.w3schools.com/tags/att_data-.asp

    Id value example:
    public class HiResDateTime
    	private static long lastTimeStamp = DateTime.UtcNow.Ticks;
    	private static readonly Regex digitsOnly = new Regex(@"[^\d]");
    	public static long UtcNowTicks
    			long original, newValue;
    				original = lastTimeStamp;
    				long now = DateTime.UtcNow.Ticks;
    				newValue = Math.Max(now, original + 1);
    			} while (Interlocked.CompareExchange
    						 (ref lastTimeStamp, newValue, original) != original);
    			return newValue;
    	public static string UtcNowTicksString => digitsOnly.Replace(UtcNowTicks.ToString(), "");