コード例 #1
0
 /// <inheritdoc/>
 public override void Insert(InsertionContext context)
 {
     if (text != null)
     {
         context.InsertText(text);
     }
 }
コード例 #2
0
 /// <inheritdoc/>
 public override void Insert(InsertionContext context)
 {
     if (targetElement != null)
     {
         TextAnchor start = context.Document.CreateAnchor(context.InsertionPosition);
         start.MovementType    = AnchorMovementType.BeforeInsertion;
         start.SurviveDeletion = true;
         string inputText = targetElement.Text;
         if (inputText != null)
         {
             context.InsertText(ConvertText(inputText));
         }
         TextAnchor end = context.Document.CreateAnchor(context.InsertionPosition);
         end.MovementType    = AnchorMovementType.BeforeInsertion;
         end.SurviveDeletion = true;
         AnchorSegment segment = new AnchorSegment(start, end);
         context.RegisterActiveElement(this, new BoundActiveElement(context, targetElement, this, segment));
     }
 }